private void attach_TblSubpoenaFrms(TblSubpoenaFrm entity) { this.SendPropertyChanging(); entity.TblState = this; }
private void detach_TblSubpoenaFrms(TblSubpoenaFrm entity) { this.SendPropertyChanging(); entity.TblCounty = null; }
partial void DeleteTblSubpoenaFrm(TblSubpoenaFrm instance);
partial void UpdateTblSubpoenaFrm(TblSubpoenaFrm instance);
partial void InsertTblSubpoenaFrm(TblSubpoenaFrm instance);
protected void btnSave_Click(object sender, EventArgs e) { String NewCaseId=""; //if (DrpDwnCity.SelectedIndex > 0 && txtGrpName.Text.Trim() != string.Empty // && txtNatureofBsns1.Text.Trim() != string.Empty && txtAddr1.Text.Trim() != string.Empty) //string queryautonum = " select isnull(MAX(CaseId),0)+1 from TblSubpoenaFrm where ISNUMERIC(CaseId)=1"; string queryautonum = "select isnull(MAX(SUBSTRING(CaseId,6,6)),0)+1 from TblSubpoenaFrm"; DataSet Result = DbConnection.GetMultitableTableData(queryautonum); String CaseIdUpld=""; //try //{ if (btnSave.Text.Equals("Save")) { // Constants cons = new Constants(); if (txtEditSubpoeanaId.Value != null && txtEditSubpoeanaId.Value != "" && int.Parse(txtEditSubpoeanaId.Value.ToString()) > 0) { AccreditationDataContext objDB = new AccreditationDataContext(); objDB.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"]; using (AccreditationDataContext group = new AccreditationDataContext()) { LINQ.TblSubpoenaFrm Sbf = objDB.TblSubpoenaFrms.First(D => D.SubpoenaFrmId == int.Parse(txtEditSubpoeanaId.Value.ToString())); CaseIdUpld=Sbf.CaseId; Sbf.SubpoenaName = txtSubpoenaName.Text.Trim(); Sbf.StateId = Convert.ToInt16(DrpDwnState.SelectedItem.Value); Sbf.CountyId = Convert.ToInt16(DrpDwnCounty.SelectedItem.Value); Sbf.GroupId = Convert.ToInt16(DropDownGroup.SelectedItem.Value); Sbf.Supervisor = txtSupervisor.Text.Trim(); Sbf.Representative = txtRepresentative.Text.Trim(); // Sbf.PDFPath = pdfFileName; Sbf.DetectiveId = Convert.ToInt16(DropDownDetective.SelectedItem.Value); // Sbf.CaseId = "CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")); // OfficialName = // DetativeName = txtAddr1.Text.Trim(), Sbf.OfficialName = string.Empty;// "Test name"; Sbf.DetativeName = DropDownDetective.SelectedItem.Text;// "Test"; // Sbf.Status = Constants.Status.NEW.ToString(); Sbf.SaveType = "Save"; Sbf.Date = (txtDate.Text.Trim().ToString().Length > 0) ? Convert.ToDateTime(txtDate.Text.Trim()) : System.DateTime.Now; Sbf.Custodian = txtCustodian.Text.Trim(); Sbf.RecordsPertainTo = txtRecordsPertainTo.Text.Trim(); Sbf.AddressIndividualBusiness = txtAddressIndividualBusiness.Text.Trim(); Sbf.CrimeUnderInvestigation = txtCrimeUnderInvestigation.Text.Trim(); Sbf.FSS = txtFSS.Text.Trim(); Sbf.Suspect = txtSuspect.Text.Trim(); Sbf.Offense = txtOffense.Text.Trim(); Sbf.InformationRequested = txtInformationRequested.Text.Trim(); // Disclaimer = Sbf.ProbableCause = txtProbableCause.Text.Trim(); //Status = Sbf.Disclaimer = chkboxYes.Checked == true ? true : false; Sbf.SignatureRequired = txtRepresentative.Text.Trim(); Sbf.DisclaimerYes = chkboxNo.Checked == true ? true : false; Sbf.IsDigitalSupervisor = RdoSupDigSig.Checked == true ? true : false; Sbf.IsDigitalRepresentative = RdoDigSig.Checked == true ? true : false; Sbf.SupervisorSignatureRequired = txtSupervisorSig.Text.Trim(); Sbf.RepresentativeSig = txtRepresentativeSig.Text.Trim(); Sbf.Active = true; if (UploadRepFile.HasFile) Sbf.RepresentiveSignatureFile = getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); if (UploadSupFile.HasFile) Sbf.SupervisorSignatureFile = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); // CreatedOn = System.DateTime.Now, Sbf.UpdatedBy = Session["UserEmail"].ToString(); Sbf.UpdatedOn = System.DateTime.Now; objDB.SubmitChanges(); } } else { using (AccreditationDataContext subpoena = new AccreditationDataContext()) { CaseIdUpld="CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")); TblSubpoenaFrm subpoena1 = new TblSubpoenaFrm { SubpoenaName = txtSubpoenaName.Text.Trim(), StateId = Convert.ToInt16(DrpDwnState.SelectedItem.Value), CountyId = Convert.ToInt16(DrpDwnCounty.SelectedItem.Value), GroupId = Convert.ToInt16(DropDownGroup.SelectedItem.Value), Supervisor = txtSupervisor.Text.Trim(), Representative = txtRepresentative.Text.Trim(), DetectiveId = Convert.ToInt16(DropDownDetective.SelectedItem.Value), CaseId = "CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")), // OfficialName = // DetativeName = txtAddr1.Text.Trim(), OfficialName =string.Empty,// "Test name", DetativeName = DropDownDetective.SelectedItem.Text,//string.Empty,//"Test", Status =((int)BLL.Constants.Status.NEW).ToString(),// Constants.Status.NEW.ToString(), SaveType = "Save", Date = (txtDate.Text.Trim().ToString().Length > 0) ? Convert.ToDateTime(txtDate.Text.Trim()) : System.DateTime.Now, Custodian = txtCustodian.Text.Trim(), RecordsPertainTo = txtRecordsPertainTo.Text.Trim(), AddressIndividualBusiness = txtAddressIndividualBusiness.Text.Trim(), CrimeUnderInvestigation = txtCrimeUnderInvestigation.Text.Trim(), FSS = txtFSS.Text.Trim(), Suspect = txtSuspect.Text.Trim(), Offense = txtOffense.Text.Trim(), InformationRequested = txtInformationRequested.Text.Trim(), // Disclaimer = ProbableCause = txtProbableCause.Text.Trim(), //Status = Disclaimer = chkboxYes.Checked == true ? true : false, DisclaimerYes = chkboxNo.Checked == true ? true : false, IsDigitalSupervisor = RdoSupDigSig.Checked == true ? true : false, IsDigitalRepresentative = RdoDigSig.Checked == true ? true : false, SupervisorSignatureRequired = txtSupervisorSig.Text.Trim(), SignatureRequired = txtRepresentative.Text.Trim(), RepresentativeSig = txtRepresentativeSig.Text.Trim(), Active = true, CreatedBy = Session["UserEmail"].ToString(), CreatedOn = System.DateTime.Now, RepresentiveSignatureFile=UploadRepFile.HasFile==true?getUploadFileName(CaseIdUpld,UploadRepFile.FileName,REPRESENTATIVE_SIGNATURE):string.Empty, SupervisorSignatureFile = UploadSupFile.HasFile == true ? getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE) : string.Empty, //UpdatedOn = System.DateTime.Now }; NewCaseId = subpoena1.CaseId; subpoena.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"]; subpoena.TblSubpoenaFrms.InsertOnSubmit(subpoena1); subpoena.SubmitChanges(); } } if (UploadRepFile.HasFile) { UploadFile(getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE), REPRESENTATIVE_SIGNATURE); HypRepSig.Text = getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); HypRepSig.NavigateUrl = "Uploads/Signature/" + getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); } if (UploadSupFile.FileName != "") { UploadFile(getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE), SUPERVISOR_SIGNATURE); HypSupSig.Text = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); HypSupSig.NavigateUrl = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); } } if(NewCaseId !="") showOutputMessage((int)BLL.Constants.MessageType.Success, "Subpoena Saved Successfully..Case ID is " + NewCaseId); //Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Subpoena Saved Successfully..Case ID is " + NewCaseId + "');window.location.href='SubpoenaProducers.aspx';", true); else showOutputMessage((int)BLL.Constants.MessageType.Success, "Subpoena Updated Successfully"); //Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Subpoena Updated Successfully');window.location.href='SubpoenaProducers.aspx';", true); Response.AddHeader("REFRESH", "5;URL=SubpoenaProducers.aspx"); return; // } //catch(Exception Ex) //{ //} }
protected void bntSubmit_Click(object sender, EventArgs e) { //string pdfFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_Subpoeana.pdf"; string pdfFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_Subpoeana.pdf"; AccreditationDataContext objDB = new AccreditationDataContext(); objDB.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"]; String CaseIdUpld = ""; int subpoeanaCuurId = 0; if (txtEditSubpoeanaId.Value != null && txtEditSubpoeanaId.Value != "" && int.Parse(txtEditSubpoeanaId.Value.ToString()) > 0) { subpoeanaCuurId = int.Parse(txtEditSubpoeanaId.Value.ToString()); using (AccreditationDataContext group = new AccreditationDataContext()) { LINQ.TblSubpoenaFrm Sbf = objDB.TblSubpoenaFrms.First(D => D.SubpoenaFrmId == int.Parse(txtEditSubpoeanaId.Value.ToString())); CaseIdUpld = Sbf.CaseId; Sbf.SubpoenaName = txtSubpoenaName.Text.Trim(); Sbf.StateId = Convert.ToInt16(DrpDwnState.SelectedItem.Value); Sbf.CountyId = Convert.ToInt16(DrpDwnCounty.SelectedItem.Value); Sbf.GroupId = Convert.ToInt16(DropDownGroup.SelectedItem.Value); Sbf.Supervisor = txtSupervisor.Text.Trim(); Sbf.Representative = txtRepresentative.Text.Trim(); Sbf.PDFPath = pdfFileName; Sbf.DetectiveId = Convert.ToInt16(DropDownDetective.SelectedItem.Value); // Sbf.CaseId = "CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")); // OfficialName = // DetativeName = txtAddr1.Text.Trim(), Sbf.OfficialName = string.Empty;// "Test name"; Sbf.DetativeName = DropDownDetective.SelectedItem.Text;// string.Empty;// "Test"; Sbf.Status = ((int)BLL.Constants.Status.NEW).ToString();// "New"; Sbf.SaveType = "Submit"; Sbf.Date = (txtDate.Text.Trim().ToString().Length > 0) ? Convert.ToDateTime(txtDate.Text.Trim()) : System.DateTime.Now; Sbf.Custodian = txtCustodian.Text.Trim(); Sbf.RecordsPertainTo = txtRecordsPertainTo.Text.Trim(); Sbf.AddressIndividualBusiness = txtAddressIndividualBusiness.Text.Trim(); Sbf.CrimeUnderInvestigation = txtCrimeUnderInvestigation.Text.Trim(); if (UploadRepFile.HasFile) Sbf.RepresentiveSignatureFile = getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); if (UploadSupFile.HasFile) Sbf.SupervisorSignatureFile = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); Sbf.FSS = txtFSS.Text.Trim(); Sbf.Suspect = txtSuspect.Text.Trim(); Sbf.Offense = txtOffense.Text.Trim(); Sbf.InformationRequested = txtInformationRequested.Text.Trim(); Sbf.IsDigitalSupervisor = RdoSupDigSig.Checked == true ? true : false; Sbf.IsDigitalRepresentative = RdoDigSig.Checked == true ? true : false; // Disclaimer = Sbf.ProbableCause = txtProbableCause.Text.Trim(); // Sbf.SignatureRequired=txt Sbf.Active = true; Sbf.UpdatedBy = Session["UserEmail"].ToString(); // Sbf.CreatedOn = System.DateTime.Now; Sbf.UpdatedOn = System.DateTime.Now; objDB.SubmitChanges(); showOutputMessage((int)BLL.Constants.MessageType.Success, "Subpoena submitted Successfully"); } } else { // string queryautonum = "select isnull(MAX(CaseId),0)+1 from TblSubpoenaFrm where ISNUMERIC(CaseId)=1"; string queryautonum = "select isnull(MAX(SUBSTRING(CaseId,6,6)),0)+1 from TblSubpoenaFrm"; DataSet Result = DbConnection.GetMultitableTableData(queryautonum); using (AccreditationDataContext subpoena = new AccreditationDataContext()) { CaseIdUpld = "CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")); TblSubpoenaFrm subpoena1 = new TblSubpoenaFrm { SubpoenaName = txtSubpoenaName.Text.Trim(), StateId = Convert.ToInt16(DrpDwnState.SelectedItem.Value), CountyId = Convert.ToInt16(DrpDwnCounty.SelectedItem.Value), GroupId = Convert.ToInt16(DropDownGroup.SelectedItem.Value), Supervisor = txtSupervisor.Text.Trim(), Representative = txtRepresentative.Text.Trim(), PDFPath = pdfFileName, DetectiveId = Convert.ToInt16(DropDownDetective.SelectedItem.Value), CaseId = "CASE-" + Result.Tables[0].Rows[0][0].ToString().PadLeft(6, Convert.ToChar("0")), // OfficialName = // DetativeName = txtAddr1.Text.Trim(), OfficialName =string.Empty,// "Test name", DetativeName =DropDownDetective.SelectedItem.Text,// "Test", Status = ((int)BLL.Constants.Status.NEW).ToString(),//"New", SaveType = "Submit", Date = (txtDate.Text.Trim().ToString().Length > 0) ? Convert.ToDateTime(txtDate.Text.Trim()) : System.DateTime.Now, Custodian = txtCustodian.Text.Trim(), RecordsPertainTo = txtRecordsPertainTo.Text.Trim(), AddressIndividualBusiness = txtAddressIndividualBusiness.Text.Trim(), CrimeUnderInvestigation = txtCrimeUnderInvestigation.Text.Trim(), IsDigitalSupervisor = RdoSupDigSig.Checked == true ? true : false, IsDigitalRepresentative = RdoDigSig.Checked == true ? true : false, RepresentiveSignatureFile = UploadRepFile.HasFile == true ? getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE) : string.Empty, SupervisorSignatureFile = UploadSupFile.HasFile == true ? getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE) : string.Empty, FSS = txtFSS.Text.Trim(), Suspect = txtSuspect.Text.Trim(), Offense = txtOffense.Text.Trim(), InformationRequested = txtInformationRequested.Text.Trim(), SignatureRequired = txtRepresentative.Text.Trim(), RepresentativeSig = txtRepresentativeSig.Text.Trim(), // Disclaimer = ProbableCause = txtProbableCause.Text.Trim(), //Status = Active = true, CreatedOn = System.DateTime.Now, CreatedBy = Session["UserEmail"].ToString(), //UpdatedOn = System.DateTime.Now }; if (UploadRepFile.HasFile) { UploadFile(getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE), REPRESENTATIVE_SIGNATURE); HypRepSig.Text = getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); HypRepSig.NavigateUrl = "Uploads/Signature/" + getUploadFileName(CaseIdUpld, UploadRepFile.FileName, REPRESENTATIVE_SIGNATURE); } if (UploadSupFile.FileName != "") { UploadFile(getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE), SUPERVISOR_SIGNATURE); HypSupSig.Text = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); HypSupSig.NavigateUrl = getUploadFileName(CaseIdUpld, UploadSupFile.FileName, SUPERVISOR_SIGNATURE); } //UploadSupFile.SaveAs(Server.MapPath("Uploads/Signature\\" + UploadSupFile.FileName)); subpoena.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"]; subpoena.TblSubpoenaFrms.InsertOnSubmit(subpoena1); subpoena.SubmitChanges(); subpoeanaCuurId = subpoena1.SubpoenaFrmId; showOutputMessage((int)BLL.Constants.MessageType.Success, "Subpoena submitted Successfully"); } } CreatePdfFile(pdfFileName); var userRegDetect = objDB.TblUserRegistrations.Where(x => x.UserId == Convert.ToInt16(DropDownDetective.SelectedItem.Value)).FirstOrDefault(); SendMail(userRegDetect.UserEmail, userRegDetect.UserFirstName, subpoeanaCuurId, userRegDetect.Group); Response.AddHeader("REFRESH", "5;URL=SubpoenaProducers.aspx"); //Response.Redirect("SubpoenaProducers.aspx"); return; }