protected void grid_Export_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxTextBox txtHouseNo = this.grid_Export.FindEditFormTemplateControl("txtHouseNo") as ASPxTextBox; ASPxTextBox txtRefNo = this.grid_Export.FindEditFormTemplateControl("txtRefNo") as ASPxTextBox; int oid = SafeValue.SafeInt(this.grid_Export.GetRowValues(this.grid_Export.EditingRowVisibleIndex, new string[] { "Id" }), 0); string sql = "select StatusCode from air_job where Id=" + oid + ""; string jobStatus = SafeValue.SafeString(Manager.ORManager.ExecuteScalar(sql)); if (s == "VoidHouse") { #region VoidHouse string sql_cnt = string.Format("select count(SequenceId) from XAArInvoiceDet where MastType='AE' and MastRefNo='{0}' and JobRefNo='{1}' ", txtRefNo.Text, txtHouseNo.Text); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_cnt), 0); if (cnt > 0) { e.Result = "Billing"; return; } if (jobStatus == "CNL") { sql = string.Format("update air_job set StatusCode='USE' where Id={0}", oid); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { UpdateMast(txtRefNo.Text); EzshipLog.Log(txtRefNo.Text, txtHouseNo.Text, "AE", "Unvoid"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { string refType = "AE"; bool closeByEst = EzshipHelper.GetCloseEstInd(txtHouseNo.Text, refType); if (closeByEst) { sql = string.Format("update air_job set StatusCode='CNL' where Id={0}", oid); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { UpdateMast(txtRefNo.Text); EzshipLog.Log(txtRefNo.Text, txtHouseNo.Text, "AE", "Void"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } }
protected void grid_Transport_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxPageControl pageControl = this.grid_Transport.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox masterId = pageControl.FindControl("txt_Id") as ASPxTextBox; ASPxTextBox jobNo = pageControl.FindControl("txt_JobNo") as ASPxTextBox; string userId = HttpContext.Current.User.Identity.Name; if (s == "VoidJob") { #region void master //billing string sql_cnt = string.Format("select count(SequenceId) from XAArInvoiceDet where MastType='TPT' and MastRefNo='{0}'", jobNo.Text); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_cnt), 0); if (cnt > 0) { e.Result = "Billing"; return; } ASPxLabel closeIndStr = pageControl.FindControl("lb_JobStatus") as ASPxLabel; string sql = "select StatusCode from TPT_Job where JobNo='" + jobNo.Text + "'"; string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "N");// closeIndStr.Text; if (closeInd == "CNL") { sql = string.Format("update TPT_Job set StatusCode='USE',UpdateBy='{1}',UpdateDateTime='{2}' where JobNo='{0}'", jobNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { EzshipLog.Log(jobNo.Text, "", "TPT", "Unvoid"); e.Result = "Success"; } else { e.Result = "Fail"; } } else { bool closeByEst = EzshipHelper.GetCloseEstInd(jobNo.Text, "TPT"); if (closeByEst) { sql = string.Format("update TPT_Job set StatusCode='CNL',UpdateBy='{1}',UpdateDateTime='{2}' where JobNo='{0}'", jobNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { EzshipLog.Log(jobNo.Text, "", "TPT", "Void"); e.Result = "Success"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } if (s == "CloseJob") { #region close job ASPxLabel closeIndStr = pageControl.FindControl("lab_CloseInd") as ASPxLabel; ASPxButton btn = pageControl.FindControl("btn_CloseJob") as ASPxButton; string sql = "select StatusCode from Tpt_Job where id='" + masterId.Text + "'"; string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// closeIndStr.Text; if (closeInd == "CLS") { sql = string.Format("update Tpt_Job set StatusCode='USE' where Id='{0}'", masterId.Text); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { EzshipLog.Log(jobNo.Text, "", "TPT", "Open"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "N"; } else { e.Result = "Fail"; } } else { sql = string.Format("update Tpt_Job set StatusCode='CLS' where Id='{2}'", DateTime.Today.ToString("yyyy-MM-dd"), userId, masterId.Text); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { EzshipLog.Log(jobNo.Text, "", "TPT", "Close"); e.Result = "Success"; //btn.Text = "Open Job"; //closeIndStr.Text = "Y"; } else { e.Result = "Fail"; } } #endregion } if (s == "Save") { e.Result = SaveJob(); } }
protected void grid_ref_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox masterId = this.grid_ref.FindEditFormTemplateControl("txt_Id") as ASPxTextBox; string userId = HttpContext.Current.User.Identity.Name; ASPxLabel closeIndStr = this.grid_ref.FindEditFormTemplateControl("lab_CloseInd") as ASPxLabel; ASPxTextBox txt_RefN = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox; ASPxButton btn = this.grid_ref.FindControl("btn_CloseJob") as ASPxButton; string sql = string.Format("select StatusCode from air_ref where Id={0}", masterId.Text); string statusCode = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); if (s == "VoidMaster") { #region void master string sql_cnt = string.Format("select count(SequenceId) from XAArInvoiceDet where MastType='AI' and MastRefNo='{0}' ", txt_RefN.Text); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_cnt), 0); if (cnt > 0) { e.Result = "Billing"; return; } if (statusCode == "CNL") { sql = string.Format("update air_ref set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AI", "Unvoid"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { string refType = "AI"; bool closeByEst = EzshipHelper.GetCloseEstInd(txt_RefN.Text, refType); if (closeByEst) { sql = string.Format("update air_ref set StatusCode='CNL' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='CNL' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AI", "Void"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } if (s == "CloseJob") { #region close job if (statusCode == "CLS") { sql = string.Format("update air_ref set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AI", "Open"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "N"; } else { e.Result = "Fail"; } } else { string refType = "AI"; bool closeByEst = EzshipHelper.GetCloseEstInd(txt_RefN.Text, refType); if (closeByEst) { sql = string.Format("update air_ref set StatusCode='CLS', CloseDate='{0}' ,CloseUser='******' where RefNo='{2}'", DateTime.Today.ToString("yyyy-MM-dd"), userId, txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='CLS' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AI", "Close"); e.Result = "Success"; //btn.Text = "Open Job"; //closeIndStr.Text = "Y"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } }
protected void grid_ref_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox refNo = pageControl.FindControl("txt_RefN") as ASPxTextBox; ASPxTextBox masterId = pageControl.FindControl("txtSequenceId") as ASPxTextBox; string userId = HttpContext.Current.User.Identity.Name; if (s == "VoidMaster") { #region void master //billing string sql_cnt = string.Format("select count(SequenceId) from XAArInvoiceDet where MastType='SE' and MastRefNo='{0}'", refNo.Text); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_cnt), 0); if (cnt > 0) { e.Result = "Billing"; return; } ASPxLabel closeIndStr = pageControl.FindControl("lb_JobStatus") as ASPxLabel; string sql = "select statusCode from SeaExportRef where RefNo='" + refNo.Text + "'"; string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// closeIndStr.Text; if (closeInd == "CNL") { sql = string.Format("update SeaExportRef set statusCode='USE',UpdateBy='{1}',UpdateDateTime='{2}' where RefNo='{0}'", refNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { string refType = this.txt_RefType.Text; if (refType.Length > 2) { EzshipLog.Log(refNo.Text, "", refType.Substring(0, 2) == "SE" ? "SE" : "SCT", "Unvoid"); } else { EzshipLog.Log(refNo.Text, "", refType, "Unvoid"); } e.Result = "Success"; } else { e.Result = "Fail"; } } else { string refType = this.txt_RefType.Text; bool closeByEst = EzshipHelper.GetCloseEstInd(refNo.Text, refType); if (closeByEst) { sql = string.Format("update SeaExportRef set statusCode='CNL',UpdateBy='{1}',UpdateDateTime='{2}' where RefNo='{0}'", refNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { if (refType.Length > 2) { EzshipLog.Log(refNo.Text, "", refType.Substring(0, 2) == "SE" ? "SE" : "SCT", "Unvoid"); } else { EzshipLog.Log(refNo.Text, "", refType, "Unvoid"); } e.Result = "Success"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } if (s == "CloseJob") { #region close job ASPxLabel closeIndStr = pageControl.FindControl("lab_CloseInd") as ASPxLabel; ASPxButton btn = pageControl.FindControl("btn_RefCloseJob") as ASPxButton; string sql = string.Format("select statusCode from SeaExportRef where SequenceId='{0}'", masterId.Text); string statusCode = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "N");// closeIndStr.Text; if (statusCode == "CLS") { sql = string.Format("update SeaExportRef set statusCode='USE',UpdateBy='{1}',UpdateDateTime='{2}' where RefNo='{0}'", refNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { string refType = this.txt_RefType.Text; if (refType != null) { EzshipLog.Log(refNo.Text, "", refType.Substring(0, 2) == "SE" ? "SE" : "SCT", "Open"); } e.Result = "Success"; } else { e.Result = "Fail"; } } else { string refType = this.txt_RefType.Text; bool closeByEst = EzshipHelper.GetCloseEstInd(refNo.Text, refType); if (closeByEst) { sql = string.Format("update SeaExportRef set statusCode='CLS',UpdateBy='{1}',UpdateDateTime='{2}' where RefNo='{0}'", refNo.Text, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { if (refType != null) { EzshipLog.Log(refNo.Text, "", refType.Substring(0, 2) == "SE" ? "SE" : "SCT", "Close"); } e.Result = "Success"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } }