//public void BindDrpOrg() //{ // BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>(); // Organization_mst ObjOrganization = new Organization_mst(); // col = ObjOrganization.Get_All(); // DrpOrg.DataTextField = "Orgname"; // DrpOrg.DataValueField = "orgid"; // DrpOrg.DataSource = col; // DrpOrg.DataBind(); //} protected void btnSave_Click(object sender, EventArgs e) { objOrganization = objOrganization.Get_Organization(); int FlagStatus, FlagStatus1; int userid = Convert.ToInt16(Request.QueryString[0]); ObjUserLogin.Userid = userid; ObjUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue.ToString()); if (lblAdUser.Text.ToString().Trim() == "Yes") { ObjUserLogin.ADEnable = true; } else { ObjUserLogin.ADEnable = false; } if (DropEnable.SelectedValue == "1") { ObjUserLogin.Enable = true; } else { ObjUserLogin.Enable = false; } ObjUserLogin.Orgid = objOrganization.Orgid; ObjUserLogin.Username = txtUserName.Text.ToString().Trim(); ObjUserLogin.Password = txtPassword.Text.ToString().Trim(); ObjContactInfo.Firstname = txtFname.Text.ToString().Trim(); ObjContactInfo.Lastname = txtLname.Text.ToString().Trim(); ObjContactInfo.Mobile = txtMobile.Text.ToString().Trim(); ObjContactInfo.Landline = txtLandline.Text.ToString().Trim(); ObjContactInfo.Empid = txtEmpId.Text.ToString().Trim(); ObjContactInfo.Siteid = Convert.ToInt16(DrpSite.SelectedValue.ToString()); ObjContactInfo.Deptid = Convert.ToInt16(DrpDepartment.SelectedValue.ToString()); ObjContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); ObjContactInfo.Description = txtDesc.Text.ToString().Trim(); ObjContactInfo.Userid = userid; FlagStatus = ObjUserLogin.Update(); FlagStatus1 = ObjContactInfo.Update(); RoleInfo_mst objR = new RoleInfo_mst(); int roleid = Convert.ToInt16(ViewState["Roleid"].ToString()); objR = objRole.Get_By_id(roleid); if (objR.Roleid != 0) { Roles.RemoveUserFromRole(txtUserName.Text.ToString().Trim(), objR.Rolename); Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), dropRole.SelectedItem.Text.ToString().Trim()); } if (FlagStatus == 1 && FlagStatus1 == 1) { // Redirect to page ViewSite.aspx page after successfully Updation Response.Redirect("~/admin/ViewUser.aspx"); } else { //If Updation is not successfully,Display Error Message //lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString().Trim(); } }
protected void btnadd_Click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { #region Fetch Current User // Fetch Current User and assign to local variable userName MembershipUser User = Membership.GetUser(); string userName = User.UserName.ToString(); #endregion ObjOrganization = ObjOrganization.Get_Organization(); int orgid = Convert.ToInt32(ObjOrganization.Orgid); int userid = ObjUser.Get_By_UserName(userName, orgid); ObjChangeNotes.Username = userid; ObjChangeNotes.Changeid = Convert.ToInt32(Request.QueryString[0]); ObjChangeNotes.Comments = txtcomments.Text.ToString(); ObjChangeNotes.Insert(); string myScript; myScript = "<script language=javascript>refreshParent();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnapprove_Click(object sender, EventArgs e) { int userid = 0; int incidentid = Convert.ToInt16(Session["incidentid"].ToString()); if (incidentid != 0) { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } objIncidentLog.Incidentid = incidentid; objIncidentLog.Userid = userid; objIncidentLog.Incidentlog = txtcomments.Text; objIncidentLog.Insert(); string myScript; myScript = "<script language=javascript>javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } }
protected void btnSolutionAdd_Click(object sender, EventArgs e) {///Add Exception handilng try catch change by vishal 21-05-2012 try { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Solution = drpSolutionType.SelectedValue; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Page_Load(object sender, EventArgs e) { //lblUser.Text = Session["User"].ToString(); if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } //added by lalit to view Mail link only to SDE. checking here SDE is logged on. if (Roles.IsUserInRole(User.UserName.ToString(), "SDE")) { trautocall.Visible = true; //trRejectedcall.Visible = true; } if (Roles.IsUserInRole(User.UserName.ToString(), "admin")) { //trautocall.Visible = true; trRejectedcall.Visible = true; } //if (Roles.IsUserInRole(User.UserName.ToString(), "SDE")) //{ // //trautocall.Visible = true; // trRejectedcall.Visible = true; //} } }
protected void Page_Load(object sender, EventArgs e) { ///Add Exception handilng try catch change by vishal 21-05-2012 try { #region Get Current User and his Role MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } #endregion }
protected void Page_Load(object sender, EventArgs e) { ////Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { string userName; userName = User.UserName.ToString(); if (Roles.IsUserInRole(userName, "admin")) { panel1.Visible = true; } objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; // Bind_Tree(); BindRepeater(); } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Page_Load(object sender, EventArgs e) {///Add Exception handilng try catch change by vishal 21-05-2012 try { //lblUser.Text = Session["User"].ToString(); if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnSolutionAdd_Click(object sender, EventArgs e) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content=Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt16(drpTopic.SelectedValue); ObjSolution.Solution = drpSolutionType.SelectedValue; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjSolutionKeyword.Keywords=txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid); }
//function to check user exist or not protected void CheckUserExist() { lblerrmsg.Text = ""; // BindDropSite(); // BindDropDept(); #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); int usrid = Convert.ToInt16(objUser.Userid); int tempuser = 0; if (objUser.Userid == 0) { string myScript; tempuser = 1; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); Session["tempuser"] = tempuser; //txtassignasset.Text = ""; } else { IncidentToAsset(usrid); ContactInfo_mst objConInfo = new ContactInfo_mst(); objConInfo = objConInfo.Get_By_id(usrid); txtEmail.Text = objConInfo.Emailid; //txtassignasset.Text = assetid.ToString(); //txtassignasset.Text = compname; Session["assignassetid"] = assetid; Session["UserCreate"] = "Exist"; } string username1 = txtUsername.Text.Trim().ToString(); Session["Username"] = username1; Session["Email"] = txtEmail.Text; #endregion }
protected void btnSolutionAdd_Click(object sender, EventArgs e) { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content = Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt16(drpTopic.SelectedValue); ObjSolution.Solution = drpSolutionType.SelectedValue; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjSolutionKeyword.Keywords = txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid); }
protected void txtUsername_TextChanged(object sender, EventArgs e) { #region Find Userid of User who is Requesting to log a call /////Add Exception handilng try catch change by vishal 21-05-2012 try { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid == 0) { string myScript; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } else { ViewState["UserCreate"] = "Exist"; ContactInfo_mst objCont = new ContactInfo_mst(); objCont = objCont.Get_By_id(ObjUserLogin.Userid); txtEmail.Text = objCont.Emailid; } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } #endregion }
protected void Orggrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { Organization_mst orgobj = new Organization_mst(); string name, desc, id; int orgid = 0; name = ((TextBox)Orggrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Orggrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Orggrdvw.Rows[e.RowIndex].Cells[0].Text); if (name != "") { orgid = Convert.ToInt32(id); orgobj.Orgid = orgid; orgobj.Orgname = name; orgobj.Description = desc; orgobj.Update(); Orggrdvw.EditIndex = -1; BindGrid(); lblErrorMsg.Text = Resources.MessageResource.errupdate.ToString(); } else { lblErrorMsg.Text = "Organization Name should not be empty"; } }
protected void Page_Load(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Page_Load(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnapprove_Click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { int userid = 0; int incidentid = Convert.ToInt32(Session["incidentid"].ToString()); if (incidentid != 0) { //objIncidentLog = objIncidentLog.Get_By_id(incidentid); //if (objIncidentLog.Incidentid != 0) //{ // objIncidentLog.Incidentid = incidentid; // objIncidentLog.Incidentlog = txtcomments.Text; // objIncidentLog.Update(); //} //else //{ // objIncidentLog.Incidentid = incidentid; // objIncidentLog.Incidentlog = txtcomments.Text; // objIncidentLog.Insert(); //} string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } objIncidentLog.Incidentid = incidentid; objIncidentLog.Userid = userid; objIncidentLog.Incidentlog = txtcomments.Text; objIncidentLog.Insert(); string myScript; myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void GetUserDetail() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); txtUsername.Text = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { ContactInfo_mst objConInfo = new ContactInfo_mst(); userid = objUser.Userid; IncidentToAsset(userid); objConInfo = objConInfo.Get_By_id(userid); txtEmail.Text = objConInfo.Emailid; txtassignasset.Text = compname; } } }
public void updatecomment() { string userName; MembershipUser User = Membership.GetUser(); solutionstatusid = Convert.ToInt16(Request.QueryString[0]); flag = Convert.ToInt16(Request.QueryString[1]); int userid; if (flag == 3) { string seeionsid = Session["SolutionId"].ToString(); string[] str = seeionsid.Split(new char[] { ',' }); foreach (string s in str) { if (s == "") { break; } int solid = Convert.ToInt16(s); ObjSolution = ObjSolution.Get_By_id(solid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } } else { int solutionid = Convert.ToInt16(Request.QueryString[1]); ObjSolution = ObjSolution.Get_By_id(solutionid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solutionid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } }
protected void Regiongrdvw_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { objOrganization = objOrganization.Get_Organization(); e.Row.Cells[2].Text = objOrganization.Orgname; } }
public void updatecomment() { string userName; MembershipUser User = Membership.GetUser(); solutionstatusid = Convert.ToInt32(Request.QueryString[0]); flag = Convert.ToInt32(Request.QueryString[1]); int userid; if (flag == 3) { string seeionsid = Session["SolutionId"].ToString(); string[] str = seeionsid.Split(new char[] { ',' }); foreach (string s in str) { if (s == "") { break; } int solid = Convert.ToInt32(s); ObjSolution = ObjSolution.Get_By_id(solid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } } else { int solutionid = Convert.ToInt32(Request.QueryString[1]); ObjSolution = ObjSolution.Get_By_id(solutionid); ObjSolution.Title = ObjSolution.Title; ObjSolution.Topicid = ObjSolution.Topicid; ObjSolution.Content = ObjSolution.Content; ObjSolution.Comments = txtcomments.Text; ObjSolution.SolutionStatus = solutionstatusid; ObjSolution.Update(); userName = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); ObjSolutionCreator.Solutionid = solutionid; ObjSolutionCreator.LastUpdateBy = objUser.Userid; ObjSolutionCreator.Update(); } }
protected void Orggrdvw_RowDeleting(object sender, GridViewDeleteEventArgs e) { int orgid=0; Organization_mst orgobj = new Organization_mst(); orgid = Convert.ToInt16(Orggrdvw.Rows[e.RowIndex].Cells[0].Text); orgobj.Delete(orgid); BindGrid(); lblErrorMsg.Text = Resources.MessageResource.errdelete.ToString(); }
public void BindGrid() { BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>(); Organization_mst orgobj = new Organization_mst(); col = orgobj.Get_All(); Orggrdvw.DataSource = col; Orggrdvw.DataBind(); clearControl(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { reqValRegion.ErrorMessage = Resources.MessageResource.errRegionName.ToString(); objOrganization = objOrganization.Get_Organization(); BindGrid(); } }
protected void IncidentToAsset(int userid) { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); userid = Convert.ToInt16(objUser.Userid); assetid = Convert.ToInt16(objusertoasset.Get_AssetId_By_UserId(userid)); objassetmst = objassetmst.Get_By_id(assetid); compname = objassetmst.Computername; }
public void BindGrid() { BLLCollection <Organization_mst> col = new BLLCollection <Organization_mst>(); Organization_mst orgobj = new Organization_mst(); col = orgobj.Get_All(); Orggrdvw.DataSource = col; Orggrdvw.DataBind(); clearControl(); }
protected void Orggrdvw_RowDeleting(object sender, GridViewDeleteEventArgs e) { int orgid = 0; Organization_mst orgobj = new Organization_mst(); orgid = Convert.ToInt32(Orggrdvw.Rows[e.RowIndex].Cells[0].Text); orgobj.Delete(orgid); BindGrid(); lblErrorMsg.Text = Resources.MessageResource.errdelete.ToString(); }
protected void BindDropSite() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; colUserToSite = ObjUserToSite.Get_All_By_userid(userid); foreach (UserToSiteMapping obj in colUserToSite) { int siteid; Site_mst objSite1 = new Site_mst(); siteid = obj.Siteid; objSite1 = objSite1.Get_By_id(siteid); if (objSite1.Siteid != 0) { colSite.Add(objSite1); } } } drpSite.DataTextField = "sitename"; drpSite.DataValueField = "siteid"; drpSite.DataSource = colSite; drpSite.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpSite.Items.Add(item); drpSite.SelectedValue = "0"; //drpSite1.DataTextField = "sitename"; //drpSite1.DataValueField = "siteid"; //drpSite1.DataSource = colSite; //drpSite1.DataBind(); //ListItem item1= new ListItem(); //item1.Text = "-------------Select-------------"; //item1.Value = "0"; //drpSite1.Items.Add(item1); //drpSite1.SelectedValue = "0"; } }
protected void btnapprove_Click(object sender, EventArgs e) { int userid=0; int incidentid = Convert.ToInt16(Session["incidentid"].ToString()); if (incidentid != 0) { //objIncidentLog = objIncidentLog.Get_By_id(incidentid); //if (objIncidentLog.Incidentid != 0) //{ // objIncidentLog.Incidentid = incidentid; // objIncidentLog.Incidentlog = txtcomments.Text; // objIncidentLog.Update(); //} //else //{ // objIncidentLog.Incidentid = incidentid; // objIncidentLog.Incidentlog = txtcomments.Text; // objIncidentLog.Insert(); //} string userName=""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } objIncidentLog.Incidentid = incidentid; objIncidentLog.Userid = userid; objIncidentLog.Incidentlog = txtcomments.Text; objIncidentLog.Insert(); string myScript; myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } }
protected void BindDropSite() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; colUserToSite = ObjUserToSite.Get_All_By_userid(userid); foreach (UserToSiteMapping obj in colUserToSite) { int siteid; Site_mst objSite1 = new Site_mst(); siteid = obj.Siteid; objSite1 = objSite1.Get_By_id(siteid); if (objSite1.Siteid != 0) { int custid = Convert.ToInt16(drpCustomer.SelectedValue); int flag = objCustToSite.Get_By_Id(custid, objSite1.Siteid); if (flag == 1) { colSite.Add(objSite1); } } } } drpSite.DataTextField = "sitename"; drpSite.DataValueField = "siteid"; drpSite.DataSource = colSite; drpSite.DataBind(); if (colSite.Count == 0) { ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpSite.Items.Add(item); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } }
protected void GetUserDetail() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); txtUsername.Text = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); //objRole = objRole.Get_By_id(roleid); if (objUser.Userid != 0) { ContactInfo_mst objConInfo = new ContactInfo_mst(); userid = objUser.Userid; IncidentToAsset(userid); objConInfo = objConInfo.Get_By_id(userid); txtEmail.Text = objConInfo.Emailid; txtassignasset.Text = compname; //priorityid = Convert.ToInt32(objConInfo.userpriority); //BindDropPriority(int priorityid); //ContactInfo_mst objcnt = new ContactInfo_mst(); //if (objRole.roleid != 1) //{ if (objConInfo.userpriority == 1) { priorityid = objPriority.Get_By_PriorityName("High"); } else { priorityid = objPriority.Get_By_PriorityName("Medium"); } //} Priority_mst objP = new Priority_mst(); objP = objPriority.Get_By_id(priorityid); colPriority.Add(objP); drpPriority.DataTextField = "name"; drpPriority.DataValueField = "priorityid"; drpPriority.DataSource = colPriority; drpPriority.DataBind(); } } }
//*Start* Code added by Shrikant protected void Regiongrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, desc, id; int Regionid = 0; int FlagRegion; int organizationId; objOrganization = objOrganization.Get_Organization(); organizationId = objOrganization.Orgid; clearControl(); name = ((TextBox)Regiongrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Regiongrdvw.Rows[e.RowIndex].Cells[3].Controls[0]).Text; id = Convert.ToString(Regiongrdvw.Rows[e.RowIndex].Cells[0].Text); Regionid = Convert.ToInt16(id); Regionobj = Regionobj.Get_By_id(Regionid); if (Regionobj.Regionname == name) { Regionobj.Regionname = name; Regionobj.Description = desc; Regionobj.Update(); Regiongrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else { FlagRegion = Regionobj.Get_By_RegionName(name, organizationId); if ((FlagRegion == 0) && (name != "")) { Regionobj.Regionname = name; Regionobj.Description = desc; Regionobj.Update(); Regiongrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else { Regiongrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errRegionExist.ToString(); } } }
// Event handler btnShow_Click , To Bind Sites to Grid View on the Selected Username and Region protected void btnShow_Click(object sender, EventArgs e) { // Declare local Variable gvIDs,Username,organizationId and FlagStatus string gvIDs; string Username; int organizationId; int FlagStatus; lblErrorMsg.Text = ""; // To get the Object of Organization ,to find the organization id objOrganization = objOrganization.Get_Organization(); // Assign Organization Id to local variable organizationId organizationId = objOrganization.Orgid; // Assign Username from textbox to local variable Username Username = txtUserName.Text.ToString().Trim(); // Get Object of UserLogin_mst Class on the basis of username and OrganizationId objUser = objUser.Get_UserLogin_By_UserName(Username, organizationId); // If Userid is not equal to Zero ,then user Exist if (objUser.Userid != 0) { // Bind Grid of Sites BindGrid(); // To check row by row of gridview ,how many sites have been mapped to this user from table UserToSiteMapping foreach (GridViewRow gv in grdvwSite.Rows) { // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec"); // Get the Site Id from variable of Label type declare in GridView of grdvwSite gvIDs = ((Label)gv.FindControl("SiteID")).Text.ToString(); // Check if gvIDs is not null if (gvIDs != "") { // Declare local variable userid and siteid to get userid and SiteId int userid; int siteid; userid = Convert.ToInt16(objUser.Userid); siteid = Convert.ToInt16(gvIDs); // To Find Current Site to this User is Mapped by Calling Function objUserToSite.Get_By_Id() FlagStatus = objUserToSite.Get_By_Id(userid, siteid); // If FlagStatus is not zero then site is mapped to this user if (FlagStatus != 0) { //Checked checkbox to show site is mapped to this user deleteChkBxItem.Checked = true; } } } } }
protected void Page_Load(object sender, EventArgs e) { #region Get Current User and his Role MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } #endregion }
protected void btnapprove_Click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { int userid = 0; int incidentid = Convert.ToInt32(Session["incidentid"].ToString()); if (incidentid != 0) { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } objIncidentLog.Incidentid = incidentid; objIncidentLog.Userid = userid; objIncidentLog.Incidentlog = txtcomments.Text; objIncidentLog.Insert(); string myScript; myScript = "<script language=javascript>javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnorgadd_Click(object sender, EventArgs e) { orgobj = orgobj.Get_Organization(); if (orgobj.Orgid == 0) { orgobj.Orgname = txtorgname.Text.Trim(); orgobj.Description = txtorgdesc.Text.Trim(); orgobj.Createdatetime = DateTime.Now.ToString(); orgobj.Insert(); BindGrid(); lblErrorMsg.Text = Resources.MessageResource.erradd.ToString(); } else { lblErrorMsg.Text = Resources.MessageResource.errAddOrg.ToString(); } }
public object GenerateOrganization_mstObject(ref IDataReader returnData) { Organization_mst obj = new Organization_mst(); while (returnData.Read()) { DateTime Mydatetime = new DateTime(); obj.Orgid = (int)returnData["Orgid"]; obj.Orgname = (string)returnData["Orgname"]; obj.Description = (string)returnData["Description"]; Mydatetime = (DateTime)returnData["Createdatetime"]; obj.Createdatetime = Mydatetime.ToString(); } returnData.Close(); returnData.Dispose(); return obj; }
public object GenerateOrganization_mstObject(ref IDataReader returnData) { Organization_mst obj = new Organization_mst(); while (returnData.Read()) { DateTime Mydatetime = new DateTime(); obj.Orgid = (int)returnData["Orgid"]; obj.Orgname = (string)returnData["Orgname"]; obj.Description = (string)returnData["Description"]; Mydatetime = (DateTime)returnData["Createdatetime"]; obj.Createdatetime = Mydatetime.ToString(); } returnData.Close(); returnData.Dispose(); return(obj); }
protected void txtUsername_TextChanged(object sender, EventArgs e) { #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid == 0) { string myScript; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } else { ViewState["UserCreate"] = "Exist"; } #endregion }
public CollectionBase GenerateOrganization_mstCollection(ref IDataReader returnData) { BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>(); while (returnData.Read()) { DateTime Mydatetime = new DateTime(); Organization_mst obj = new Organization_mst(); obj.Orgid = (int)returnData["Orgid"]; obj.Orgname = (string)returnData["Orgname"]; obj.Description = (string)returnData["Description"]; Mydatetime = (DateTime)returnData["Createdatetime"]; obj.Createdatetime = Mydatetime.ToString(); col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }
protected void btnadd_Click(object sender, EventArgs e) { #region Fetch Current User // Fetch Current User and assign to local variable userName MembershipUser User = Membership.GetUser(); string userName = User.UserName.ToString(); #endregion ObjOrganization = ObjOrganization.Get_Organization(); int orgid = Convert.ToInt16(ObjOrganization.Orgid); int userid = ObjUser.Get_By_UserName(userName, orgid); ObjProblemNotes.UserName = userid; ObjProblemNotes.Problemid = Convert.ToInt16(Request.QueryString[0]); ObjProblemNotes.Comments = txtcomments.Text.ToString(); ObjProblemNotes.Insert(); string myScript; myScript = "<script language=javascript>refreshParent();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); }
protected void btnadd_Click(object sender, EventArgs e) { #region Fetch Current User // Fetch Current User and assign to local variable userName MembershipUser User = Membership.GetUser(); string userName = User.UserName.ToString(); #endregion ObjOrganization = ObjOrganization.Get_Organization(); int orgid = Convert.ToInt16(ObjOrganization.Orgid); int userid = ObjUser.Get_By_UserName(userName, orgid); ObjChangeNotes.Username = userid; ObjChangeNotes.Changeid = Convert.ToInt16(Request.QueryString[0]); ObjChangeNotes.Comments = txtcomments.Text.ToString(); ObjChangeNotes.Insert(); string myScript; myScript = "<script language=javascript>refreshParent();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); }
protected void btnRegionadd_Click(object sender, EventArgs e) { int regionid=0; int organizationId; objOrganization = objOrganization.Get_Organization(); organizationId=objOrganization.Orgid; regionid = Regionobj.Get_By_RegionName(txtregionname.Text.ToString(), organizationId); if(regionid ==0) { Regionobj.Regionname = txtregionname.Text.ToString(); Regionobj.Description = txtregiondesc.Text.ToString(); Regionobj.Orgid = organizationId; Regionobj.Insert(); BindGrid(); lblerrmsg.Text = Resources.MessageResource.erradd.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.errRegionExist.ToString(); } Dispose(); }
protected void btnSolutionAdd_Click(object sender, EventArgs e) { ///Add Exception handilng try catch change by vishal 21-05-2012 try { string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); int Solutionid; ObjSolution.Title = txtTitle.Text.ToString(); ObjSolution.Content=Editor.Text.ToString(); ObjSolution.Topicid = Convert.ToInt32(drpTopic.SelectedValue); ObjSolution.Solution = drpSolutionType.SelectedValue; ObjSolution.Insert(); Solutionid = ObjSolutionKeyword.Get_SolutionId(); ObjSolutionKeyword.Keywords=txtKeywords.Text.ToString(); ObjSolutionKeyword.Solutionid = Solutionid; ObjSolutionKeyword.Insert(); ObjSolutionCreator.Solutionid = Solutionid; ObjSolutionCreator.Createdby = objUser.Userid; ObjSolutionCreator.Insert(); objSentMailToUser.SentMailToPManager(Solutionid); Response.Redirect("ViewSolution.aspx?solutionid" + Solutionid); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void buttonadd_click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { // FlagUserStatus = false; } #endregion #endregion ObjChange.Active = true; ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); ///ObjChange.Technician = ""; ObjChange.Title = txtTitle.Text; ObjChange.Description = txtDescription.Text; ObjChange.Createdtime = DateTime.Now.ToString(); ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue); ObjChange.Approvalstatus = "Send For Approval"; MembershipUser user = Membership.GetUser(); string username = user.UserName.ToString(); objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(username, objOrganization.Orgid); int userid = Convert.ToInt32(ObjUserLogin.Userid); ObjChange.CreatedByID = userid; //////////change doneby meenakshi objservice = objservice.Get_By_id(Convert.ToInt32(drpservices.SelectedValue)); if (objservice.servicename != null) { ObjChange.servicename = objservice.servicename; } else { ObjChange.servicename = ""; } ////////end ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text, objOrganization.Orgid); ObjChange.Requestedby = ObjUserLogin.Userid; //ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue); ObjChange.Insert(); int changeid = ObjChange.Get_Current_Changeid(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { if (ListAsset.Items[i].Selected == true) { Objincludeaasetchange.Assetid = Convert.ToInt32(ListAsset.Items[i].Value); Objincludeaasetchange.Changeid = changeid; Objincludeaasetchange.Insert(); } } objIncidentToChange.Changeid = changeid; objIncidentToChange.Incidentid = Convert.ToInt32(Session["incidentid"]); objIncidentToChange.Insert(); int changetype = Convert.ToInt32(ObjChange.Changetype); objSentEmailToChange.SentMailToChangeCommittee(changeid, changetype); ScriptManager.RegisterStartupScript(this, this.GetType(), "Close()", "Close();", true); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void BindGridForSelectedParameter() { #region Declaration of localvariable and table Variable int filterId; DataTable dtTable = new DataTable(); dtTable = CreateDataTable(); string userName = ""; int varTechnicianId = Convert.ToInt32(drpTechnician.SelectedValue); string varSortParameter = ""; varSortParameter = drpSort.SelectedValue; if (varSortParameter == "0") { varSortParameter = "createdatetime"; } #endregion #region Get Current User and his Role MembershipUser User = Membership.GetUser(); string varUserRole = ""; string varRoleTechnician = ""; if (User != null) { userName = User.UserName.ToString(); string[] arrUserRole = Roles.GetRolesForUser(); varUserRole = arrUserRole[0].ToString(); varRoleTechnician = Resources.MessageResource.strTechnicianRole.ToString(); } #endregion #region Get User object by Calling Function Get_UserLogin_By_UserName() via passing parameter username and organizationid objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); #endregion #region If User Exist if (objUser.Userid != 0) { string fromdate = null; string todate = null; if (ViewState["fromdate"] != null) { fromdate = ViewState["fromdate"].ToString(); } if (ViewState["todate"] != null) { todate = ViewState["todate"].ToString(); } if (fromdate == "") { fromdate = null; } if (todate == "") { todate = null; } #region Declare Local Variables and Collection of Incident_mst Type string Status; BLLCollection<Incident_mst> col = new BLLCollection<Incident_mst>(); int siteid; #endregion #region Get the Siteid and Filter Parameter siteid = Convert.ToInt32(drpSite.SelectedValue); filterId = Convert.ToInt32(drpFilter.SelectedValue); #endregion #region If Role of User is Technician if (varUserRole == varRoleTechnician) { lblTechnician.Visible = false; drpTechnician.Visible = false; #region If Filter Variable is All if (filterId == 0) { col = objIncident.Get_All_By_Siteid_Technicianid(siteid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Open else if (filterId == 1) { Status = Resources.MessageResource.strStatusOpen.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid_technicianid(siteid, statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter variable is Onhold else if (filterId == 2) { Status = Resources.MessageResource.strStatusOnHold.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid_technicianid(siteid, statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Close else if (filterId == 3) { Status = Resources.MessageResource.strStatusClose.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid_technicianid(siteid, statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If filter variable is resolved else if (filterId == 4) { Status = Resources.MessageResource.strStatusResolved.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid_technicianid(siteid, statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion } #endregion #region If User Role is other than Technician else { #region If Filter Variable is All if (filterId == 0) { col = objIncident.Get_All_By_Siteid_Createdbyid(siteid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Open else if (filterId == 1) { Status = Resources.MessageResource.strStatusOpen.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid(siteid, statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter variable is Onhold else if (filterId == 2) { Status = Resources.MessageResource.strStatusOnHold.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid(siteid, statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Close else if (filterId == 3) { Status = Resources.MessageResource.strStatusClose.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid(siteid, statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If filter variable is resolved else if (filterId == 4) { Status = Resources.MessageResource.strStatusResolved.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid(siteid, statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If filter variable is UnAssigned else if (filterId == 5) { Status = Resources.MessageResource.strStatusOpen.ToString(); int statusid; statusid = objStatus.Get_By_StatusName(Status); col = objIncident.Get_All_By_Siteid_Statusid_Unassigned(siteid, statusid, fromdate, todate, varSortParameter); } #endregion #region If filter variable is Assigned else if (filterId == 6) { col = objIncident.Get_All_By_Siteid_Assigned(siteid, fromdate, todate, varSortParameter); } #endregion #region Else Condition will call using Filter variable all else { col = objIncident.Get_All_By_Siteid_Createdbyid(siteid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion } #endregion #region Fetch Each object of type Incident_mst from Collection Incident_mst foreach (Incident_mst objInc in col) { #region Create Table row and assign value to it DataRow row; row = dtTable.NewRow(); row["incidentid"] = Convert.ToString(objInc.Incidentid); row["title"] = objInc.Title; row["requesterid"] = Convert.ToString(objInc.Requesterid); row["createdbyid"] = Convert.ToString(objInc.Createdbyid); row["siteid"] = Convert.ToString(objInc.Siteid); row["createdatetime"] = Convert.ToString(objInc.Createdatetime); objIncidentStates = objIncidentStates.Get_By_id(objInc.Incidentid); row["statusid"] = objIncidentStates.Statusid; row["technicianid"] = objIncidentStates.Technicianid; row["priorityid"] = objIncidentStates.Priorityid; dtTable.Rows.Add(row); #endregion } #endregion } #endregion #region Bind Grid from datasource dtTable DataView dvData = new DataView(dtTable); string sortFormat = "{0} {1}"; String sortDirection = "DESC"; if (varSortParameter == "createdatetime") { //varSortParameter = "incidentid"; } if (varSortParameter == "incidentid") { } dvData.Sort = String.Format(sortFormat, varSortParameter, sortDirection); grdvwRequest.DataSource = null; grdvwRequest.DataBind(); grdvwRequest.DataSource = dvData; grdvwRequest.DataBind(); #endregion if (varUserRole == varRoleTechnician) { RoleTechnician(); } }
//#region Handle Button btnAssigned Click Event //protected void btnAssigned_Click(object sender, EventArgs e) //{ // #region Fetch Each Row from GridView,and Check Which Check Box is Selected // foreach (GridViewRow gv in grdvwRequest.Rows) // { // string gvIDs; // #region Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row // CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec"); // #endregion // #region If deleteChkBxItem is Checked then ,mapped Current site to this user // if (deleteChkBxItem.Checked) // { // #region Declare local Variables // int incidentid; // int varSiteid; // int oldtechnicianvalue; // #endregion // #region Get the Incident Id from variable of Label type declare in GridView of grdvwSite // gvIDs = ((Label)gv.FindControl("incidentid")).Text.ToString(); // #endregion // #region Convert to incident id into integer // incidentid = Convert.ToInt32(gvIDs); // #endregion // #region If Incident id in Not Null // if (gvIDs != "") // { // Incident_mst objInc = new Incident_mst(); // IncidentStates objIncSta = new IncidentStates(); // objIncSta = objIncSta.Get_By_id(incidentid); // if (objIncSta.Incidentid != 0) // { // oldtechnicianvalue = objIncSta.Technicianid; // int technicianid=Convert.ToInt32(drpTechnician1.SelectedValue); // if(technicianid!=0) // { // int userid = Convert.ToInt32(ViewState["Userid"].ToString()); // #region Update into IncidentStates Table // objIncidentStates.Incidentid = incidentid; // objIncidentStates.Technicianid = technicianid; // objIncidentStates.Subcategoryid = objIncSta.Subcategoryid; // objIncidentStates.Statusid = objIncSta.Statusid; // objIncidentStates.Requesttypeid = objIncSta.Requesttypeid; // objIncidentStates.Priorityid = objIncSta.Priorityid; // objIncidentStates.Categoryid = objIncSta.Categoryid; // objIncidentStates.AssignedTime = objIncSta.AssignedTime; // objIncidentStates.Update(); // #endregion // #region Insert into IncidentHistory Table // objIncidentHistory.Incidentid = incidentid; // objIncidentHistory.Operationownerid = userid; // objIncidentHistory.Operation = "update"; // objIncidentHistory.Insert(); // #endregion // #region Get the Current historyid by calling function Get_Current_IncidentHistoryid() // int historyid = objIncidentHistory.Get_Current_IncidentHistoryid(); // #endregion // #region If technician value is changed,Insert into IncidentHistoryDiff table // #region Declare Local variables // string columnName; // string prev_value; // string curnt_value; // #endregion // #region Get Column Name from MessageResource File // columnName = Resources.MessageResource.strColumnTechnicianid.ToString(); // #endregion // prev_value = Convert.ToString(oldtechnicianvalue); // curnt_value = Convert.ToString(drpTechnician1.SelectedValue); // objIncidentHistoryDiff.Historyid = historyid; // objIncidentHistoryDiff.Columnname = columnName; // objIncidentHistoryDiff.Current_value = curnt_value; // objIncidentHistoryDiff.Prev_value = prev_value; // objIncidentHistoryDiff.Insert(); // if (objIncSta.AssignedTime == null) // { // columnName = Resources.MessageResource.strColumnAssignedTime.ToString(); // prev_value = "0"; // curnt_value = DateTime.Now.ToString(); // objIncidentHistoryDiff.Historyid = historyid; // objIncidentHistoryDiff.Columnname = columnName; // objIncidentHistoryDiff.Current_value = curnt_value; // objIncidentHistoryDiff.Prev_value = prev_value; // objIncidentHistoryDiff.Insert(); // } // else // { // columnName = "AssignedTime"; // prev_value = objIncSta.AssignedTime; // curnt_value = DateTime.Now.ToString(); // objIncidentHistoryDiff.Historyid = historyid; // objIncidentHistoryDiff.Columnname = columnName; // objIncidentHistoryDiff.Current_value = curnt_value; // objIncidentHistoryDiff.Prev_value = prev_value; // objIncidentHistoryDiff.Insert(); // } // #endregion // objInc = objIncident.Get_By_id(incidentid); // if (objInc.Siteid != Convert.ToInt32(drpSite1.SelectedValue)) // { // int oldsiteid = objInc.Siteid; // int oldslaid = objInc.Slaid; // objInc.Siteid = Convert.ToInt32(drpSite1.SelectedValue); // int SLAid = objIncident.Get_By_SLAid(Convert.ToInt32(drpSite1.SelectedValue), objIncSta.Priorityid ); // int requesttypeid = Convert.ToInt32(Resources.MessageResource.strRequestTypeId.ToString()); // if (requesttypeid == Convert.ToInt32(objIncSta.Requesttypeid )) // { // SLAid = 0; // } // objInc.Slaid = SLAid; // objInc.Active = true; // objInc.Update(); // #region If site value is changed,Insert into IncidentHistoryDiff table // columnName = Resources.MessageResource.strColumnSiteid.ToString(); // prev_value = Convert.ToString(oldsiteid); // curnt_value = drpSite1.SelectedValue; // objIncidentHistoryDiff.Historyid = historyid; // objIncidentHistoryDiff.Columnname = columnName; // objIncidentHistoryDiff.Current_value = curnt_value; // objIncidentHistoryDiff.Prev_value = prev_value; // objIncidentHistoryDiff.Insert(); // #endregion // #region If SLA value is changed,Insert into IncidentHistoryDiff table // columnName = Resources.MessageResource.strColumnSLAid.ToString(); // prev_value = Convert.ToString(oldslaid); // curnt_value = Convert.ToString(SLAid); // objIncidentHistoryDiff.Historyid = historyid; // objIncidentHistoryDiff.Columnname = columnName; // objIncidentHistoryDiff.Current_value = curnt_value; // objIncidentHistoryDiff.Prev_value = prev_value; // objIncidentHistoryDiff.Insert(); // #endregion // } // } // } // varSiteid = Convert.ToInt32(drpSite.SelectedValue); // if (varSiteid == 0) // { BindGridForAllParameter(); } // else { BindGridForSelectedParameter(); } // } // #endregion // } // #endregion // } // #endregion //} //#endregion protected void BindSelectedFilter() { string keyword = Session["keyword"].ToString(); string Filterid = Session["Filterid"].ToString(); string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); string Uid = objUser.Userid.ToString(); #region Declaration of localvariable and table Variable DataTable dtTable = new DataTable(); dtTable = CreateDataTable(); #endregion BLLCollection<Incident_mst> col = new BLLCollection<Incident_mst>(); col = objIncident.Get_All_Incidentid_By_SearchParameter(Filterid, keyword,Uid); #region Create Table row and assign value to it foreach (Incident_mst obj in col) { IncidentStates objS = new IncidentStates(); DataRow row; row = dtTable.NewRow(); row["incidentid"] = Convert.ToString(obj.Incidentid); row["title"] = obj.Title; row["requesterid"] = Convert.ToString(obj.Requesterid); row["createdbyid"] = Convert.ToString(obj.Createdbyid); row["siteid"] = Convert.ToString(obj.Siteid); row["createdatetime"] = Convert.ToString(obj.Createdatetime); objS = objS.Get_By_id(obj.Incidentid); row["statusid"] = objS.Statusid; row["technicianid"] = objS.Technicianid; row["priorityid"] = objS.Priorityid; dtTable.Rows.Add(row); } #endregion grdvwRequest.DataSource = dtTable; grdvwRequest.DataBind(); Session.Remove("Filterid"); Session.Remove("keyword"); ViewState["keyword"] = keyword; ViewState["Filterid"] = Filterid; }
protected void BindGridForAllParameter() { #region Declaration of localvariable and table Variable int filterId; DataTable dtTable = new DataTable(); dtTable = CreateDataTable(); string userName = ""; int varTechnicianId = 0; if (drpTechnician.SelectedValue != "") { varTechnicianId = Convert.ToInt32(drpTechnician.SelectedValue); } string varSortParameter = ""; varSortParameter = drpSort.SelectedValue; if (varSortParameter == "0") { varSortParameter = "createdatetime"; } #endregion #region Get Current User and his Role MembershipUser User = Membership.GetUser(); string varUserRole = ""; string varRoleTechnician = ""; if (User != null) { userName = User.UserName.ToString(); string[] arrUserRole = Roles.GetRolesForUser(); varUserRole = arrUserRole[0].ToString(); varRoleTechnician = Resources.MessageResource.strTechnicianRole.ToString(); } #endregion #region Get User object by Calling Function Get_UserLogin_By_UserName() via passing parameter username and organizationid objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); #endregion #region if UserExist if (objUser.Userid != 0) { ViewState["Userid"] = objUser.Userid; string fromdate = null; string todate = null; if (ViewState["fromdate"] != null) { fromdate = ViewState["fromdate"].ToString(); } if (ViewState["todate"] != null) { todate = ViewState["todate"].ToString(); } if (fromdate == "") { fromdate = null; } if (todate == "") { todate = null; } #region Declare Local Variables and Collection of Incident_mst Type string Status; // int siteid; #endregion #region Get the Siteid and Filter Parameter //siteid = obj.Siteid; filterId = Convert.ToInt32(drpFilter.SelectedValue); #endregion #region If Role of User is Technician if (varUserRole == varRoleTechnician) { lblTechnician.Visible = false; drpTechnician.Visible = false; //lblTechnician1.Visible = false; //drpTechnician1.Visible = false; //btnAssigned.Visible = false; #region If Filter Variable is All if (filterId == 0) { // col = objIncident.Get_All_By_Siteid_Technicianid(siteid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Requested else if (filterId == 1) { Status = Resources.MessageResource.strChangestatusrequested.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Approval else if (filterId == 2) { Status = Resources.MessageResource.StrApproval.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Approval else if (filterId == 3) { Status = Resources.MessageResource.StrApproved.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Rejected else if (filterId == 4) { Status = Resources.MessageResource.StrRejected.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Planning else if (filterId == 5) { Status = Resources.MessageResource.StrPlanning.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Testing else if (filterId == 6) { Status = Resources.MessageResource.StrTesting.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Release else if (filterId == 7) { Status = Resources.MessageResource.StrRelease.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Implemented else if (filterId == 8) { Status = Resources.MessageResource.StrImplemented.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Completed else if (filterId == 9) { Status = Resources.MessageResource.StrCompleted.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid_technicianid(statusid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion } #endregion #region If User Role is other then technician else { #region If Filter Variable is All if (filterId == 0) { // col = objIncident.Get_All_By_Siteid_Technicianid(siteid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #region If Filter Variable is Requested else if (filterId == 1) { Status = Resources.MessageResource.strChangestatusrequested.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Approval else if (filterId == 2) { Status = Resources.MessageResource.StrApproval.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Approval else if (filterId == 3) { Status = Resources.MessageResource.StrApproved.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Rejected else if (filterId == 4) { Status = Resources.MessageResource.StrRejected.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Planning else if (filterId == 5) { Status = Resources.MessageResource.StrPlanning.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Testing else if (filterId == 6) { Status = Resources.MessageResource.StrTesting.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Release else if (filterId == 7) { Status = Resources.MessageResource.StrRelease.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Implemented else if (filterId == 8) { Status = Resources.MessageResource.StrImplemented.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion #region If Filter Variable is Completed else if (filterId == 9) { Status = Resources.MessageResource.StrCompleted.ToString(); int statusid; statusid = ObjChangeStatus.Get_By_StatusName(Status); col = ObjChange.Get_All_By_Statusid(statusid, fromdate, todate, varTechnicianId, varSortParameter); } #endregion } #endregion } #endregion #region Fetch Each object of type Change_mst from Collection Change_mst foreach (Change_mst obj in col) { #region Create Table row and assign value to it DataRow row; row = dtTable.NewRow(); row["Changeid"] = Convert.ToString(obj.Changeid); row["title"] = obj.Title; row["Requestedby"] = Convert.ToString(obj.Requestedby); row["CreatedByid"] = Convert.ToString(obj.CreatedByID); row["Technician"] = Convert.ToString(obj.Technician); row["Statusid"] = obj.Statusid; row["Priority"] = obj.Priority; row["Createdtime"] = obj.Createdtime; dtTable.Rows.Add(row); #endregion } //} #endregion #region Bind Grid from datasource dtTable grdvwChange.DataSource = dtTable; grdvwChange.DataBind(); #endregion }
protected void btnSave_Click(object sender, EventArgs e) { // Save User to Database on Button Save click Event // Start objOrganization = objOrganization.Get_Organization(); //Declare Local Variables - Flag,varRolename,FlagMembership int Flag; string varRoleName; bool FlagMembership; // Use Asp.Net Membership Validator Control Membership.ValidateUser to check User Exist in aspnet Database FlagMembership = Membership.ValidateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim()); // Create Object of UserLogin_mst Class to Check User Exist in Database UserLogin_mst table UserLogin_mst objUserLogin = new UserLogin_mst(); // Declare local Variable Flag to Check Status User Exist in databse Flag = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid ); // If User Does'nt exist in Database and in aspnet databse then flag value will 0 and FlagMembership value will be False if (Flag == 0 && FlagMembership==false) { // Declare status local variable int status; // Create Object objUserLogin of UserLogin_mst() Class to insert record in table objUserLogin = new UserLogin_mst(); objUserLogin.Username = txtUserName.Text.ToString().Trim(); objUserLogin.Password = txtPassword.Text.ToString().Trim(); objUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue); objUserLogin.Orgid = objOrganization.Orgid ; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); // Call Insert function to insert record in UserLogin_mst table // Check status whether Record inserted Successfully or Not,If status=1 then Success otherwise Operation Fail status = objUserLogin.Insert(); if (status == 1) { // Declare local variable varEmail to fetch email of user from textbox string varEmail; //If Email field is Not Empty then Assign value to varEmail Local Variable if (txtEmailId.Text != "") { varEmail = txtEmailId.Text.Trim(); } // Else Assign value define in MessagesResources.resx file in errMemshipCreateUserEmail field else { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } // Assign selected text from droprole down to local variable field varRoleName varRoleName = dropRole.SelectedItem.Text.ToString().Trim(); // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user int userid; // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName userid = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid ); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured UserToSiteMapping objusertositemapping = new UserToSiteMapping(); if (userid != 0) { // Create Object objContactInfo of ContactInfo_mst class to Store User Contact Information in Contact_info table ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = userid; objContactInfo.Firstname = txtFname.Text.ToString().Trim(); objContactInfo.Lastname = txtLname.Text.ToString().Trim(); objContactInfo.Description = txtDesc.Text.ToString().Trim(); objContactInfo.Empid = txtEmpId.Text; objContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); objContactInfo.Landline = txtLandline.Text.ToString().Trim(); objContactInfo.Mobile = txtMobile.Text.ToString().Trim(); objContactInfo.Siteid = Convert.ToInt16(DrpSite.SelectedValue); //if (DrpDepartment.SelectedItem.ToString() != null) //{ objContactInfo.Deptid = Convert.ToInt16(DrpDepartment.SelectedValue); //} // Call objContactInfo.Insert function to Insert record in Contact_info table objContactInfo.Insert(); // Show Message Operation perform successfully //lblMessage.Text = Resources.MessageResource.errDataSave.ToString(); // Calling Function Clear() to Clear all controls on Form objusertositemapping.Userid = userid; objusertositemapping.Siteid = Convert.ToInt16(DrpSite.SelectedValue); objusertositemapping.Insert(); Clear(); Response.Redirect("~/admin/ViewUser.aspx"); } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message User Already Exist lblMessage.Text = Resources.MessageResource.errUserExist.ToString(); } // End Save button Click }
protected void btnAdd_Click(object sender, EventArgs e) { bool FlagUserStatus = true; #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { FlagUserStatus = false; } #endregion #endregion MembershipUser User = Membership.GetUser(); string userName; userName = User.UserName.ToString(); if (FlagUserStatus == true) { objOrganization = objOrganization.Get_Organization(); objuser = objuser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); ObjProblem.CreatedByid = objuser.Userid; ObjProblem.Requesterid = requesterid; ObjProblem.Categoryid = Convert.ToInt16(drpCategory.SelectedValue); ObjProblem.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue); ObjProblem.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); ObjProblem.Statusid = Convert.ToInt16(drpStatus.SelectedValue); ObjProblem.Technicianid = Convert.ToInt16(drpTechnician.SelectedValue); ObjProblem.title = txtTitle.Text; ObjProblem.Description = txtDescription.Text; if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { ObjProblem.AssginedTime = DateTime.Now.ToString(); } ObjProblem.Insert(); int problemid = ObjProblem.Get_Current_Problemid(); ObjProblemHistory.Operationtime = DateTime.Now.ToString(); ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operation = "create"; ObjProblemHistory.Operationownerid = objuser.Userid; if (Session["IncidentToProblem"] != null) { int incidentid = Convert.ToInt16(Session["IncidentToProblem"].ToString()); Incident_To_Problem objIncToprob = new Incident_To_Problem(); objIncToprob.Incidentid = incidentid; objIncToprob.Problemid = problemid; objIncToprob.Insert(); } if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt16(drpTechnician.SelectedValue)); } ObjProblemHistory.Insert(); //ResetControls(); string myScript; myScript = "<script language=javascript>javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } }
protected void btnUpdate_Click(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { # region Declare Local Variable string StrStatusRequested; string StrStatusRejected; string StrStatusApproval; string StrStatusApproved; string StrStatusPlanning; string StrStatusTesting; string StrStatusRelease; string StrStatusImplemented; string StrStatusCompleted; string StrStatusString = ""; int userid = 0; int changeid = Convert.ToInt32(Request.QueryString[0]); string userName = ""; #endregion #region Fetch the Status Value from Resource File StrStatusString = GetChangeStatusString(Convert.ToInt32(drpStatus.SelectedValue)); StrStatusRejected = Resources.MessageResource.StrRejected.ToString(); StrStatusApproval = Resources.MessageResource.StrApproval.ToString(); StrStatusRequested = Resources.MessageResource.StrRequested.ToString(); StrStatusApproved = Resources.MessageResource.StrApproved.ToString(); StrStatusPlanning = Resources.MessageResource.StrPlanning.ToString(); StrStatusTesting = Resources.MessageResource.StrTesting.ToString(); StrStatusRelease = Resources.MessageResource.StrRelease.ToString(); StrStatusImplemented = Resources.MessageResource.StrImplemented.ToString(); StrStatusCompleted = Resources.MessageResource.StrCompleted.ToString(); #endregion MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid if (userName != "") { Objorganization = Objorganization.Get_Organization(); ObjUser = ObjUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); if (ObjUser.Userid != 0) { userid = ObjUser.Userid; } } #endregion #region Insert Historyvalue in Change History Table int result = String.Compare(StrStatusString, StrStatusRequested, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Requested"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusRejected, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Rejected"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusApproval, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Approval"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusApproved, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Approved"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusPlanning, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Planning"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusTesting, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Testing"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusRelease, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Release"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusImplemented, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Implemented"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusCompleted, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Completed"; ObjChangeHistory.Insert(); } #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() int historyid = ObjChangeHistory.Get_Current_ChangeHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjChange = ObjChange.Get_By_id(changeid); #endregion #region Insert into ChangeHistoryDiff table ,By Comparing Current value and Updated Values if (ObjChange.Changeid != 0) { #region Declare local variable string columnName; string prev_value; string curnt_value; #endregion #region If Priority value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Priority != Convert.ToInt32(drpPriority.SelectedValue)) { columnName = Resources.MessageResource.strColumnPriorityid.ToString(); prev_value = Convert.ToString(ObjChange.Priority); curnt_value = Convert.ToString(drpPriority.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Technician value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Technician != Convert.ToInt32(drpTechnician.SelectedValue)) { columnName = Resources.MessageResource.strColumnTechnicianid.ToString(); prev_value = Convert.ToString(ObjChange.Technician); curnt_value = Convert.ToString(drpTechnician.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If category value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Categoryid != Convert.ToInt32(drpCategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnCategoryid.ToString(); prev_value = Convert.ToString(ObjChange.Categoryid); curnt_value = Convert.ToString(drpCategory.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Subcategory value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Subcategoryid != Convert.ToInt32(drpSubcategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnSubcategoryid.ToString(); prev_value = Convert.ToString(ObjChange.Subcategoryid); curnt_value = Convert.ToString(drpSubcategory.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Changetype value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Changetype != Convert.ToInt32(drpchangetype.SelectedValue)) { columnName = Resources.MessageResource.strColumnChangeType.ToString(); prev_value = Convert.ToString(ObjChange.Changetype); curnt_value = Convert.ToString(drpchangetype.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Changestatus value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Changetype != Convert.ToInt32(drpStatus.SelectedValue)) { columnName = Resources.MessageResource.strColumnstatusid.ToString(); prev_value = Convert.ToString(ObjChange.Statusid); curnt_value = Convert.ToString(drpStatus.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion } #endregion #region Update the completed status #endregion #region update the data in change_mst table ObjChange.Technician = Convert.ToInt32(drpTechnician.SelectedValue); ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue); ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue); ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjChange.Changeid = Convert.ToInt32(Request.QueryString[0]); ObjChange.Active = true; #region If Current status is closed,then Assign Completed time result = String.Compare(StrStatusString, StrStatusCompleted, true); if (result == 0) { BLLCollection<Incident_To_Change> colincidentchnage = new BLLCollection<Incident_To_Change>(); colincidentchnage = Objincidenttochange.Get_All_By_Changeid(changeid); int id = 0; foreach (Incident_To_Change objitoc in colincidentchnage) { id = Convert.ToInt32(objitoc.Incidentid); } IncidentStates objstate = new IncidentStates(); objstate = objstate.Get_By_id(id); Status_mst objincidentstats = new Status_mst(); objincidentstats = objincidentstats.Get_By_id(objstate.Statusid); string currentincidentstatus = objincidentstats.Statusname.ToString(); int comparestatus = String.Compare(currentincidentstatus, Resources.MessageResource.strStatusClose.ToString(), true); if (comparestatus == 0) { ObjChange.Completedtime = DateTime.Now.ToString(); Change_mst Objcurrentchange = new Change_mst(); ChangeStatus_mst Objchangestatus = new ChangeStatus_mst(); Objcurrentchange = Objcurrentchange.Get_By_id(changeid); Objchangestatus = Objchangestatus.Get_By_id(Objcurrentchange.Statusid); string status = Objchangestatus.Statusname.ToString(); int result1 = String.Compare(status, StrStatusCompleted, true); if (result1 == 0) { ObjChange.Completedtime = Objcurrentchange.Completedtime; ObjChange.Update(); } else { ObjChange.Completedtime = DateTime.Now.ToString(); ObjChange.Update(); } } else { string myScript; //myScript = "<script language=javascript>javascript:alert('Please Close All the Attached Incident');</script>"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Javascript:alert('Please Close Alll the attached incident');", "Javascript:alert('Please Close Alll the attached incident');", true); ///'''Page.RegisterClientScriptBlock("MyScript", myScript); } } else { #endregion ObjChange.Update(); } #endregion // #region Update Include Assets in Change value in IncludedAssetinchange //objincludeasset.Delete(changeid); //for (int i = lstassetupdate.Items.Count - 1; i >= 0; i--) //{ // if (lstassetupdate.Items[i].Selected == true) // { // objincludeasset.Assetid = Convert.ToInt32(lstassetupdate.Items[i].Value); // objincludeasset.Changeid = changeid; // objincludeasset.Insert(); // } //} //#endregion Showchangeinfo(); btnUpdate.Visible = false; btnCancel.Visible = false; }
protected void btnupdateRollOutPlan_Click(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { string prev_value; string curnt_value; int historyid; int changeid = Convert.ToInt32(Request.QueryString[0]); #region For updating values in Problem history table ObjChangeHistory.Changeid = changeid; MembershipUser User = Membership.GetUser(); string username = User.UserName.ToString(); Objorganization = Objorganization.Get_Organization(); int userid = ObjUser.Get_By_UserName(username, Objorganization.Orgid); ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "RollOutPlanUpdated"; ObjChangeHistory.Insert(); #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() historyid = ObjChangeHistory.Get_Current_ChangeHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjChange = ObjChange.Get_By_id(changeid); #endregion #region Find the value of current symptom ObjChangeRollOutPlan = ObjChangeRollOutPlan.Get_By_id(ObjChange.Changeid); #endregion #region Insert the values in history difference table prev_value = Convert.ToString(ObjChangeRollOutPlan.Description); curnt_value = Convert.ToString(EditorRollOutPlan.Text); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = "Description"; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); #endregion ObjChangeRollOutPlan.Changeid = changeid; ObjChangeRollOutPlan.Description = EditorRollOutPlan.Text.ToString(); ObjChangeRollOutPlan.Update(); ShowRollOutPlanPlaceholder(); btnupdateRollOutPlan.Visible = false; btnsaveRollOutPlan.Visible = false; btncancellRollOutPlan.Visible = false; EditorRollOutPlan.Visible = false; lnkRollOutPlanedit.Visible = true; lnkRollOutPlanadd.Visible = false; ShowImpactPlaceholder(); ShowBackOutPlanPlaceholder(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Bindgrid() { #region Declaration of localvariable and table Variable int filterId; DataTable dtTable = new DataTable(); dtTable = CreateDataTable(); string userName = ""; int varTechnicianId = 0; string varSortParameter = "createdatetime"; #endregion #region Get Current User and his Role MembershipUser User = Membership.GetUser(); string varUserRole = ""; string varRoleTechnician = ""; if (User != null) { userName = User.UserName.ToString(); string[] arrUserRole = Roles.GetRolesForUser(); varUserRole = arrUserRole[0].ToString(); varRoleTechnician = Resources.MessageResource.strTechnicianRole.ToString(); } #endregion #region Get User object by Calling Function Get_UserLogin_By_UserName() via passing parameter username and organizationid objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); #endregion #region If User Exist if (objUser.Userid != 0) { string fromdate = null; string todate = null; #region Find how many sites have been mapped to current user by calling function Get_All_By_userid() via passing parameter userid int userid = objUser.Userid; colUserToSite = ObjUserToSite.Get_All_By_userid(userid); #endregion #region Fetch each object from Collection of UserToSiteMapping foreach (UserToSiteMapping obj in colUserToSite) { #region Declare Local Variables and Collection of Incident_mst Type string Status; BLLCollection<Incident_mst> col = new BLLCollection<Incident_mst>(); int siteid; #endregion #region Get the Siteid and Filter Parameter siteid = obj.Siteid; filterId = 0; #endregion #region If Role of User is Technician #region If Filter Variable is All if (filterId == 0) { col = objIncident.Get_All_By_Siteid_Requesterid(siteid, objUser.Userid, fromdate, todate, varSortParameter); } #endregion #endregion #region Fetch Each object of type Incident_mst from Collection Incident_mst foreach (Incident_mst objInc in col) { #region Create Table row and assign value to it DataRow row; row = dtTable.NewRow(); row["incidentid"] = Convert.ToString(objInc.Incidentid); row["title"] = objInc.Title; row["requesterid"] = Convert.ToString(objInc.Requesterid); row["createdbyid"] = Convert.ToString(objInc.Createdbyid); row["siteid"] = Convert.ToString(objInc.Siteid); row["createdatetime"] = Convert.ToString(objInc.Createdatetime); objIncidentStates = objIncidentStates.Get_By_id(objInc.Incidentid); row["statusid"] = objIncidentStates.Statusid; row["technicianid"] = objIncidentStates.Technicianid; row["priorityid"] = objIncidentStates.Priorityid; dtTable.Rows.Add(row); #endregion } #endregion } #endregion #region Bind Grid from datasource dtTable DataView dvData = new DataView(dtTable); string sortFormat = "{0} {1}"; String sortDirection = "DESC"; if (varSortParameter == "createdatetime") { varSortParameter = "incidentid"; } dvData.Sort = String.Format(sortFormat, varSortParameter, sortDirection); grdvwRequest.DataSource = dvData; grdvwRequest.DataBind(); #endregion } #endregion }