|
hi all,
i am not able to update the database using gridview.
the code which i written is mentioned below
protected void Row_Updating(object sender, GridViewUpdateEventArgs e)
{
// Label lblId = (Label)CustomerGrid.Rows[e.RowIndex].FindControl("lblContactName");
TextBox txtName = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtContactName");
TextBox CompanyName = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtCompanyName");
TextBox Designation = (TextBox)CustomerGrid.Rows[e.RowIndex].FindControl("txtDesignation");
//CustomerGrid.EditIndex = -1;
string myQuery = "UPDATE [customer] SET [Contactname]=@Contactname ,[CompanyName]= @companyName,[Designation] = @Desgination where [CompanyName]= @companyName";
string dataBaseConnection = "Data Source=DAYAKAR\\sqlexpress; Initial Catalog=hospital;Integrated Security=true";
SqlConnection updateCon = new SqlConnection(dataBaseConnection);
SqlCommand updateCommand = new SqlCommand(myQuery, updateCon);
//updateCommand.Parameters.Add(new SqlParameter("@Contactname", SqlDbType.VarChar, 50));
//updateCommand.Parameters["@Contactname"].Value = txtName.Text;
updateCommand.Parameters.AddWithValue("Contactname", txtName.Text);
updateCommand.Parameters.AddWithValue("CompanyName", CompanyName.Text);
updateCommand.Parameters.AddWithValue("Designation", Designation.Text);
SqlDataAdapter updateDA = new SqlDataAdapter(updateCommand);
//CustomerGrid.EditIndex = -1;
string sqlStatement = "Select * from customer";
SqlConnection con = new SqlConnection(dataBaseConnection);
SqlCommand myCommand = new SqlCommand(sqlStatement, con);
SqlDataAdapter da = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
da.Fill(ds,"customer");
if (ds.Tables.Count > 0)
{
CustomerGrid.DataSource = ds;
CustomerGrid.DataBind();
}
}
}
by using above mentioned code i am not able to update the db.
can anybody help regarding this.
Thanks and Regards
Dayakar D.N
|
|
|
|
|
DayaKar:
What do you meant by not able to update? Are you getting any error? Have you stepped into the code?
|
|
|
|
|
Please when I display my report using the crystal report embedded with visual studio it displays my report at first click but if I click the back button and run the report again I receive a blank page.
Can someone help out on this. here is a sample code of how I load the report Or is there a better way of loading and displaying my reports
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
BindReport()
Catch ex As Exception
End Try
End Sub
Sub BindReport()
s3 = Session("rptDocName")
s2 = Session("QryStr")
s = Session("srcTable")
Try
Dim myConnection As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ToString)
Dim MyCommand As New SqlCommand()
MyCommand.CommandType = CommandType.Text
Dim MyDA As New SqlDataAdapter(s2, myConnection)
Dim myDS As New DataSet1()
MyDA.Fill(myDS, s)
Dim rdoc As New ReportDocument
rdoc.Load(Server.MapPath("rpt/" & s3 & ".rpt"))
rdoc.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rdoc
CrystalReportViewer1.DataBind()
Catch ex As Exception
End Try
End Sub
SPC Nigeria
Thanks.
|
|
|
|
|
How do I implement this new effect of displaying the application icon with the url and also with the page title the explorer tab
thanks
SPC Nigeria
Thanks.
|
|
|
|
|
Its far from new
google: favicon.ico
|
|
|
|
|
Put this between the HEAD tags somewhere:
<link rel="icon" href="[icon URL]">
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
My site has a login page. After the user logs in he can click the logout button to logout and go back to the login page. If the user does this he can easily click the browser back button to get back into the site. How can I prevent this from happening?
|
|
|
|
|
Build your site so that it doesnt matter if they click the back button.
|
|
|
|
|
When they click the back button after logging out they can see information that is left over in the browser cache from when they were logged in. How can I prevent this from happening?
|
|
|
|
|
Set no-cache but it is still up to the given browser to determine how best to do it and they may ignore your settings.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
i have in a usercontrol drpdwnlst, hyplnk, textbox and label
drpdwnlst and hplnk do not keep their values on postback the rest do
i have the usercontrol added dynamically to placeholder. all code ajaxed
|
|
|
|
|
Hi,
I have developed a web application in .net 2.0 using Word 2007, wherein I am converting a word document into a PDF file. I want to set the dcom setting in Identity tab as "Launching User" and do not want to use "Interactive User" & "This User", since client wont allow for these. I even dont want to give a Domain\Username & password in web.config file under Identity section.(Impersonation)(same reason, since Client wont allow).
When I set Identity user ( in dcom settings for word application) & access from the client machine using other username/password (other than what I have logged in on the server), I dont get any error but nothing happens even & it doesnot convert into pdf. I have also set the IIS properties for Integrated windows Authentication & unchecked the Anonymous Access checkbox.
Any solution, will be highly appreciated.
Thanks in advance
Ajay Mayekar
|
|
|
|
|
Hi,
I have a solution and in this solution are a couple of projects, and a web project. In the web project's bin folder there is a reference to one of the projects, so if the project compiles then this referenced prohect's .dll is added to the bin folder. How do I totally remove this reference? I deleted it from the bin folder, but when I compile the solution then the dll is added again.
Please can some one help.
Thanks
Brendan
|
|
|
|
|
No, the references are not in the bin folder.
In the Solution Explorer in Visual Studio you have a node named References in your project. That is where you can delete the reference.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Right Click the website take PropertyPages.There you'll find References and from that remove the project you want to delete from reference.
|
|
|
|
|
Still coming back. I have deleted several times from property pages. But after compilation it is coming back..
|
|
|
|
|
Hi all,
I have a page where i have a gridview with two buttons which open up two pop ups:
<asp:GridView ID="All_Orders_Grid" runat="server" AutoGenerateColumns="False" AllowSorting="True">
<Columns>
<asp:BoundField DataField="Order_no" HeaderText="Order No" SortExpression="Order_no" />
<asp:BoundField DataField="PARTY_Name" HeaderText="Party" SortExpression="PARTY_Name" />
<asp:BoundField DataField="Order_Date" DataFormatString="{0 :dd/MM/yyyy}" HeaderText="Order Date" HtmlEncode="False" SortExpression="Order_Date" />
<asp:BoundField DataField="Order_Deliv_Date" DataFormatString="{0 :dd/MM/yyyy}" HeaderText="Delivery Date" HtmlEncode="false" SortExpression="Order_Deliv_Date" />
<asp:BoundField DataField="supplier_loc" HeaderText="Supplier Location" SortExpression="supplier_loc" />
<asp:BoundField DataField="bill_loc" HeaderText="Billing Location" SortExpression="bill_loc" />
<asp:BoundField DataField="Order_Value" HeaderText="Ordered Amount" DataFormatString="{0 :#,###,###.00}" SortExpression="Order_Value" />
<asp:TemplateField HeaderText="Cash Advance">
<ItemTemplate>
#
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Option">
<ItemTemplate>
<table style="width: 100%; height: 100%">
<tr>
<td>
<a runat="server" id="lnk_Add">
<INPUT type="button" ID="Button_Add_Items" value="Add Items" /></a></td>
<td>
<a runat="server" id="Lnk_Edit">
<INPUT ID="Button_Edit_Qty" type="button" value="Edit Qty" /></a></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Order_no" HeaderText="Order No" SortExpression="Order_no" />
</Columns>
<RowStyle CssClass="datagrid_row1" />
<HeaderStyle CssClass="datagrid_heading" />
</asp:GridView>
</pre>
In the row datat bound event i wrote:
<pre>Dim btn1lnl As HtmlAnchor = CType(e.Row.FindControl("lnk_Add"), HtmlAnchor)
Dim btn1ln2 As HtmlAnchor = CType(e.Row.FindControl("Lnk_Edit"), HtmlAnchor)
btn1lnl.Attributes.Add("onclick", "return Open_Window(1,'" + e.Row.Cells(9).Text + "')")
btn1ln2.Attributes.Add("onclick", "return Open_Window(2,'" + e.Row.Cells(9).Text + "')")
the javascript i used to open the pop ups is
function Open_Window(option,orderno)
{
if(option==2)
{
var w=window.open('Edit_Order.aspx?ID='+orderno+'&&option=1')
return false;
}
else
{
var w= window.open('Add_OrderItems.aspx?ID='+orderno);
return false;
}
}
When i save the data in the child window i want to refresh the parent page which contains the Gridview. For this purpose i wrote the foll function in the code
<pre>Sub Show_Msg()
Dim scp As String = "<script type='text/javascript'>alert('Data Saved Successfully');CloseAndReload();</script>"
ClientScript.RegisterClientScriptBlock(Me.GetType(), "script1", scp)
End Sub</pre>
and the script use is :
<pre> function CloseAndReload()
{
window.close();
if (window.opener && !window.opener.closed)
{
window.opener.location.reload();
}
}</pre>
the problem i m facing is that this script works on my local host, but when i deployed it to the server, it gives me a message
"This page cannot be refreshed without resending information, Click
retry to send the information again ..."
if i click yes the pop up opens again and the user thinks the data was not saved.If i click no the page is not refreshed and again the user thinks the data was not saved.
Any solutions.......
When you fail to plan, you are planning to fail.
|
|
|
|
|
did u used Ajax in the parent/child page
Cheers!!
Brij
|
|
|
|
|
yes,
But its only the calendar extender control.
Its working well in local, but fails on the server.
When you fail to plan, you are planning to fail.
|
|
|
|
|
Register the script with ScriptManager as
ScriptManager.RegisterClientScriptBlock(Me.GetType(), "script1", scp)
Cheers!!
Brij
|
|
|
|
|
Hi,
I wants to redirect to another website in the webmethod.
function CallWebMethod(methodType)
{
debugger;
switch(methodType)
{
case "Select":
{
UserName.HelloWorld();
}
}
}
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
<services>
<asp:servicereference path="UserName.asmx">
<asp:button id="Button1" runat="server" text="Button" onclientclick="CallWebMethod('Select');" xmlns:asp="#unknown">
This is in webservice file UserName
I had tried i both the ways. But didn't worked.
[WebMethod]
public string HelloWorld()
{
//HttpContext.Current.Response.Status = "301 Moved Permanently";
//HttpContext.Current.Response.AddHeader("Location", "http://digitalcolony.com");
return "Hello World";
}
[WebMethod]
public string HelloWorld()
{
//HttpContext.Current.Response.Status = "301 Moved Permanently";
// HttpContext.Current.Response.Redirect("http://google.com", false);
return "Hello World";
}
Thanks in advance.
|
|
|
|
|
Hi,
I'm not sure if I understand correctly, but you want to click on a button and redirect to a new website? This is what I would do:
public void MyMethod()
{
Response.Redirect("http://www.google.com/", true);
}
Let me know if I understood correctly.
Regards
Brendan
|
|
|
|
|
Hi all
I have a textbox(tboContent) im typinh data into and another one tboCharacters i would like to display information ie the number of text i have entered in the first textbox. I have added that to the textchanged event and set autopostback to true.
I added the control as a trigger on the Update panel but nothing changes gets displayed on the display screen until i submit the form manually(say clicking another control with postback set to true)
Does anyone know how to solve this problem.
protected void tboContent_TextChanged1(object sender, EventArgs e)
{
tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
}
Thank you.
|
|
|
|
|
can u post the full code?
Cheers!!
Brij
|
|
|
|
|
public partial class Home_Page_frmSMSTemplate: System.Web.UI.Page
{
long lngSMSID = 0;
// long lngContactID = 0;
string strUserName = "";
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblNewRecord.Text = "true";
strUserName = Convert.ToString(Session["UserName"]);
//strUserName = Convert.ToString(Request.QueryString["strUsername"]);
lngSMSID = Convert.ToInt64(Request.QueryString["ID"]);
LoadSMSDetail(lngSMSID);
}
else
{
lngSMSID = Convert.ToInt64(Request.QueryString["ID"]);
strUserName = Convert.ToString(Session["UserName"]);
//strUserName = Convert.ToString(Request.QueryString["strUsername"]);
}
}
private void LoadSMSDetail(long lngSMSID)
{
try
{
LoadMergeFields();
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand SqlCmd = new SqlCommand("Get_SMSTemplate", con);
SqlDataReader dtr;
SqlCmd.Parameters.AddWithValue("@SMSTemplateID", lngSMSID);
//SqlCmd.Parameters.AddWithValue("@ContactID", lngContactID);
SqlCmd.CommandType = CommandType.StoredProcedure;
dtr = SqlCmd.ExecuteReader();
while (dtr.Read())
{
tboName.Text = (string)dtr["SMSTemplateName"];
//tboSubject.Text = (string)dtr["SMSTemplateText"];
rbtnAuditor.Checked = (bool)dtr["IsScheduledAuditor"];
rbtnSite.Checked = (bool)dtr["IsScheduledSite"];
rbtnNotification.Checked = (bool)dtr["IsNotification"];
rbtnReport.Checked = (bool)dtr["IsAuditReport"];
rbtnSample.Checked = (bool)dtr["IsScheduledSamples"];
rbtnReSite.Checked = (bool)dtr["IsReScheduledSite"];
rbtnFotten.Checked = (bool)dtr["IsForgotPassword"];
rbtnNewIncident.Checked = (bool)dtr["IsNewIncident"];
rbtnIncidentReassign.Checked = (bool)dtr["IsReassignedIncident"];
rbtnReactivatedInc.Checked = (bool)dtr["IsReactivatedIncident"];
rbtnActionsNotification.Checked = (bool)dtr["IsNewAction"];
rbtnUpdateAction.Checked = (bool)dtr["IsUpdateAction"];
rbtnDeleteAction.Checked = (bool)dtr["IsDeleteAction"];
rbtnIncidentStatus.Checked = (bool)dtr["IsIncidentStatusNotification"];
rbtnEscalation.Checked = (bool)dtr["IsEscalation"];
string mystring = (string)dtr["SMSTemplateText"];
tboContent.Text = mystring; // mystring.Replace("\n", "<br>").Replace("\r", "");
//tboCPassword.Text = (string)dtr["FtpPassword"];
lblID.Text = Convert.ToString(dtr["SMSTemplateID"]);
lblLastUpdated.Text = Convert.ToDateTime(dtr["LastUpdated"]).ToLongDateString(); //FormatThisDate(rs!LastUpdated)
//lblUpdatedBy.Text = (string)dtr["UpdatedBy"];
chkActive.Checked = (bool)dtr["Active"];
lblMergeFields.Text = ">> " + tboName.Text;
lblNewRecord.Text = "false";
tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
for (int i = 0; i < cboSMSType.Items.Count; i++)
{
foreach (System.Web.UI.Control ctrl in this.Panel1.Controls)
{
if (ctrl.GetType() == typeof(System.Web.UI.WebControls.RadioButton))
{
System.Web.UI.WebControls.RadioButton ctrl1 = (System.Web.UI.WebControls.RadioButton) ctrl;
if (ctrl1.Checked == (true))
{
if (cboSMSType.Items[i].Text == ctrl1.Text)
{
cboSMSType.SelectedIndex = i;
dtr.Close();
con.Close();
return;
}
}
}
}
}
}
dtr.Close();
}
catch (Exception ex)
{
//throw;
}
con.Close();
}
private void LoadMergeFields()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
ListItem select = new ListItem();
select.Text = "<-Select Field->";
select.Value = "0";
SqlCommand sqlcom = new SqlCommand("Get_MergeField_All", con);
sqlcom.CommandType = CommandType.StoredProcedure;
SqlDataReader dtr = sqlcom.ExecuteReader();
cboMergeField.Items.Add(select);
while (dtr.Read())
{
ListItem select1 = new ListItem();
select1.Text = (string)dtr["MergeFieldName"];
select1.Value = Convert.ToString(dtr["MergeFieldID"]);
cboMergeField.Items.Add(select1);
}
//ListItem select = new ListItem();
//select.Text = "<-Select Field->";
//select.Value = "0";
//SqlCommand sqlcom = new SqlCommand("Get_MergeField_All", con);
//sqlcom.CommandType = CommandType.StoredProcedure;
//SqlDataReader dtr = sqlcom.ExecuteReader();
//cboMergeField.Items.Add(select);
//while (dtr.Read())
//{
// ListItem select1 = new ListItem();
// select1.Text = (string)dtr["MergeFieldName"];
// select1.Value = Convert.ToString(dtr["MergeFieldID"]);
// cboMergeField.Items.Add(select1);
//}
dtr.Close();
sqlcom.Dispose();
con.Close();
}
protected void RadToolBar1_ButtonClick1(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
if ((e.Item.Text == "Save") | (e.Item.Text == "Save & Close"))
{
try
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
if (((string)lblNewRecord.Text =="true") && (ValidateFields() == true) && (CheckExist() == false))
{
SqlCommand SqlCmd = new SqlCommand("Insert_SMSTemplate", con);
SqlCmd.CommandType = CommandType.StoredProcedure;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCmd.Parameters.AddWithValue("@SMSTemplateName", tboName.Text);
//SqlCmd.Parameters.AddWithValue("@SMSTemplateSubject", tboSubject.Text);
SqlCmd.Parameters.AddWithValue("@SMSTemplateText", tboContent.Text);
SqlCmd.Parameters.AddWithValue("@IsScheduledAuditor", rbtnAuditor.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSite", rbtnSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsReScheduledSite", rbtnReSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsNotification", rbtnNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsAuditReport", rbtnReport.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSamples", rbtnSample.Checked);
SqlCmd.Parameters.AddWithValue("@IsForgotPassword", rbtnFotten.Checked);
SqlCmd.Parameters.AddWithValue("@IsNewIncident", rbtnNewIncident.Checked);
SqlCmd.Parameters.AddWithValue("@IsReassignedIncident", rbtnIncidentReassign.Checked);
SqlCmd.Parameters.AddWithValue("@IsReactivatedIncident", rbtnReactivatedInc.Checked);
SqlCmd.Parameters.AddWithValue("@IsActionsNotification", rbtnActionsNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsUpdateAction", rbtnUpdateAction.Checked);
SqlCmd.Parameters.AddWithValue("@IsDeleteAction", rbtnDeleteAction.Checked);
SqlCmd.Parameters.AddWithValue("@IsIncidentStatusNotification", rbtnIncidentStatus.Checked);
SqlCmd.Parameters.AddWithValue("@IsEscalation", rbtnEscalation.Checked);
SqlCmd.Parameters.AddWithValue("@LastUpdated", DateTime.Now);
SqlCmd.Parameters.AddWithValue("@UpdatedBy", strUserName);
SqlCmd.Parameters.AddWithValue("@Active", chkActive.Checked);
SqlParameter sqlParam = new SqlParameter("@SMSTemplateID", SqlDbType.BigInt);
sqlParam.Direction = ParameterDirection.Output;
SqlCmd.Parameters.Add(sqlParam);
SqlCmd.ExecuteReader();
lblID.Text = Convert.ToString(sqlParam.Value); //(Int32)SqlCmd.Parameters["@SiteID"].Value;
MessageBox.Show("SMS Template Saved Succesfully");
lblNewRecord.Text = "false";
lblMergeFields.Text = ">> " + tboName.Text;
con.Close();
if (e.Item.Text == "Save & Close")
{
string script = "window.close();";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", script, true);
}
}
else if (((string)lblNewRecord.Text == "false") && (ValidateFields() == true) )
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand SqlCmd = new SqlCommand("Update_SMSTemplate", con);
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCmd.Parameters.AddWithValue("@SMSTemplateID", Convert.ToInt64(lblID.Text));
SqlCmd.Parameters.AddWithValue("@SMSTemplateName", tboName.Text);
//SqlCmd.Parameters.AddWithValue("@SMSTemplateSubject", tboSubject.Text);
SqlCmd.Parameters.AddWithValue("@SMSTemplateText", tboContent.Text);
SqlCmd.Parameters.AddWithValue("@IsScheduledAuditor", rbtnAuditor.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSite", rbtnSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsReScheduledSite", rbtnReSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsNotification", rbtnNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsAuditReport", rbtnReport.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSamples", rbtnSample.Checked);
SqlCmd.Parameters.AddWithValue("@IsForgotPassword", rbtnFotten.Checked);
SqlCmd.Parameters.AddWithValue("@IsNewIncident", rbtnNewIncident.Checked);
SqlCmd.Parameters.AddWithValue("@IsReassignedIncident", rbtnIncidentReassign.Checked);
SqlCmd.Parameters.AddWithValue("@IsReactivatedIncident", rbtnReactivatedInc.Checked);
SqlCmd.Parameters.AddWithValue("@IsActionsNotification", rbtnActionsNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsUpdateAction", rbtnUpdateAction.Checked);
SqlCmd.Parameters.AddWithValue("@IsDeleteAction", rbtnDeleteAction.Checked);
SqlCmd.Parameters.AddWithValue("@IsIncidentStatusNotification", rbtnIncidentStatus.Checked);
SqlCmd.Parameters.AddWithValue("@IsEscalation", rbtnEscalation.Checked);
SqlCmd.Parameters.AddWithValue("@LastUpdated", DateTime.Now);
SqlCmd.Parameters.AddWithValue("@UpdatedBy", strUserName);
SqlCmd.Parameters.AddWithValue("@Active", chkActive.Checked);
SqlCmd.ExecuteReader();
MessageBox.Show("SMS Template Updated Succesfully");
lblNewRecord.Text = "false";
lblMergeFields.Text = ">> " + tboName.Text;
con.Close();
//InsertSiteContact(lngSiteID);
con.Close();
if (e.Item.Text == "Save & Close")
{
string script = "window.close();";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", script, true);
}
}
}
catch (Exception ex)
{
//throw;
}
}
else if (e.Item.Text == "Delete")
{
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand SqlCmd = new SqlCommand("Update_SMSTemplateSetInactive", con);
SqlCmd.CommandType = CommandType.StoredProcedure;
//con.Open();
SqlCmd.Parameters.AddWithValue("@SMSTemplateID", Convert.ToString(lblID.Text));
SqlCmd.Parameters.AddWithValue("@UpdatedBy", strUserName);
SqlCmd.Parameters.AddWithValue("@LastUpdated", lblLastUpdated.Text);
int intMyCount = SqlCmd.ExecuteNonQuery();
if (intMyCount > 0)
{
//Session["AddNewRecord"] = "true";
lblNewRecord.Text = "true";
tboName.Text = "";
cboMergeField.SelectedIndex = 0;
cboSMSType.SelectedIndex = 0;
//rbtnAllign.ClearSelection();
lblMergeFields.Text = "";
lblID.Text = "0";
//lblUpdatedBy.Text = "";
tboContent.Text = "";
MessageBox.Show("Template Deleted Succesfully");
// LoadListBox();
}
con.Close();
SqlCmd.Dispose();
}
else if (e.Item.Text == "New")
{
lblNewRecord.Text = "true";
tboName.Text = "";
lblID.Text = "0";
tboContent.Text = "";
cboMergeField.SelectedIndex = 0;
cboSMSType.SelectedIndex = 0;
lblMergeFields.Text = "";
tboContent.Text = "";
//rbtnAllign.ClearSelection();
}
}
private bool ValidateFields()
{
bool valid = false;
if ((tboName.Text == ""))
{
valid = false;
MessageBox.Show("Mandatory Field Required");
return valid;
}
else
{
valid = true;
}
return valid;
}
private bool CheckExist()
{
bool Exist = false;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand SqlCmd = new SqlCommand("Get_SMSTemplateCheckSMSTypeExists", con);
SqlDataReader dtr;
//Session["AddNewRecord"] = "false";
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCmd.Parameters.AddWithValue("@IsScheduledAuditor", rbtnAuditor.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSite", rbtnSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsReScheduledSite", rbtnReSite.Checked);
SqlCmd.Parameters.AddWithValue("@IsNotification", rbtnNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsAuditReport", rbtnReport.Checked);
SqlCmd.Parameters.AddWithValue("@IsScheduledSamples", rbtnSample.Checked);
SqlCmd.Parameters.AddWithValue("@IsForgotPassword", rbtnFotten.Checked);
SqlCmd.Parameters.AddWithValue("@IsNewIncident", rbtnNewIncident.Checked);
SqlCmd.Parameters.AddWithValue("@IsReassignedIncident", rbtnIncidentReassign.Checked);
SqlCmd.Parameters.AddWithValue("@IsReactivatedIncident", rbtnReactivatedInc.Checked);
SqlCmd.Parameters.AddWithValue("@IsActionsNotification", rbtnActionsNotification.Checked);
SqlCmd.Parameters.AddWithValue("@IsIncidentStatusNotification", rbtnIncidentStatus.Checked);
SqlCmd.Parameters.AddWithValue("@IsEscalation", rbtnEscalation.Checked);
dtr = SqlCmd.ExecuteReader();
while (dtr.Read())
{
Exist = true;
MessageBox.Show("Record Already Exist");
return Exist;
}
con.Close();
dtr.Close();
return Exist;
}
public static bool IsNumeric(string anyString)
{
if (anyString == "")
{
anyString = "0";
}
if (anyString == null)
{
anyString = "";
}
if (anyString.Length > 0)
{
double dummyOut = new double();
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US", true);
return Double.TryParse(anyString, System.Globalization.NumberStyles.Any, cultureInfo.NumberFormat, out dummyOut);
}
else { return false; }
}
protected void rbtnAllign_SelectedIndexChanged(object sender, EventArgs e)
{
//rbtnAllign.Items.Add(
}
protected void btnTest_Click(object sender, EventArgs e)
{
//Application.DoEvents();
}
protected void btnTesting_Click(object sender, EventArgs e)
{
// uploadFile(tboSubject.Text, tboName.Text, tboUserName.Text, tboPassword.Text);
}
protected void btnAdd_Click(object sender, EventArgs e)
{
// tboName.paste
//btnAdd.Attributes.Add("onclick", "ubbc(" + cboMergeField.SelectedItem.Text.ToString() + ")");
}
protected void cboMergeField_SelectedIndexChanged(object sender, EventArgs e)
{
//MID.Text = cboMergeField.SelectedItem.Text;
}
protected void rbtnNotification_CheckedChanged(object sender, EventArgs e)
{
//rbtnAuditor.Checked = false;
//rbtnSite.Checked = false;
//rbtnReSite.Checked = false;
////rbtnNotification.Checked = false;
//rbtnReport.Checked = false;
//rbtnSample.Checked = false;
}
protected void rbtnReport_CheckedChanged(object sender, EventArgs e)
{
//rbtnAuditor.Checked = false;
//rbtnSite.Checked = false;
//rbtnReSite.Checked = false;
//rbtnNotification.Checked = false;
////rbtnReport.Checked = false;
//rbtnSample.Checked = false;
}
protected void rbtnSite_CheckedChanged(object sender, EventArgs e)
{
//rbtnAuditor.Checked = false;
////rbtnSite.Checked = false;
//rbtnReSite.Checked = false;
//rbtnNotification.Checked = false;
//rbtnReport.Checked = false;
//rbtnSample.Checked = false;
}
protected void rbtnReSite_CheckedChanged(object sender, EventArgs e)
{
//rbtnAuditor.Checked = false;
//rbtnSite.Checked = false;
////rbtnReSite.Checked = false;
//rbtnNotification.Checked = false;
//rbtnReport.Checked = false;
//rbtnSample.Checked = false;
}
protected void rbtnAuditor_CheckedChanged(object sender, EventArgs e)
{
//// rbtnAuditor.Checked = false;
//rbtnSite.Checked = false;
//rbtnReSite.Checked = false;
//rbtnNotification.Checked = false;
//rbtnReport.Checked = false;
//rbtnSample.Checked = false;
}
protected void rbtnSample_CheckedChanged(object sender, EventArgs e)
{
//rbtnAuditor.Checked = false;
//rbtnSite.Checked = false;
//rbtnReSite.Checked = false;
//rbtnNotification.Checked = false;
//rbtnReport.Checked = false;
// rbtnSample.Checked = false;
}
protected void cboSMSType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
if (cboSMSType.SelectedItem.Text == "Audit Aproved Notification")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = true;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Audit Report")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = true;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Delete Action")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = true;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Update Action")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = true;
}
else if (cboSMSType.SelectedItem.Text == "Schedule Site")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = true;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Schedule Sample")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = true;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Schedule Auditor")
{
rbtnAuditor.Checked = true;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
if (cboSMSType.SelectedItem.Text == "ReSchedule Site")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = true;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Incident Status Notification")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnIncidentStatus.Checked = true;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
//rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Incident ReActivation")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = true;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Incident ReAssignment")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnIncidentReassign.Checked = true;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Action Notification")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = true;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Incident Notification")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = true;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Escalation Notification")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = true;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Password Forgotten")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = false;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = true;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
else if (cboSMSType.SelectedItem.Text == "Schedule Sample")
{
rbtnAuditor.Checked = false;
rbtnSite.Checked = false;
rbtnReSite.Checked = false;
rbtnNotification.Checked = false;
rbtnReport.Checked = false;
rbtnSample.Checked = true;
rbtnNewIncident.Checked = false;
rbtnReactivatedInc.Checked = false;
rbtnActionsNotification.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnEscalation.Checked = false;
rbtnFotten.Checked = false;
rbtnIncidentStatus.Checked = false;
rbtnIncidentReassign.Checked = false;
rbtnDeleteAction.Checked = false;
rbtnUpdateAction.Checked = false;
}
}
protected void tboContent_TextChanged(object sender, EventArgs e)
{
tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
}
protected void tboContent_TextChanged1(object sender, EventArgs e)
{
tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
}
protected void tboContent_DataBinding(object sender, EventArgs e)
{
tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
}
protected void tboContent_Init(object sender, EventArgs e)
{
}
protected void tboContent_PreRender(object sender, EventArgs e)
{
}
}
|
|
|
|
|