public void btnSave_Click(object sender, EventArgs e) { try { using (db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString)) { CommitProduce SID = db.CommitProduce.SingleOrDefault(u => u.StorageInProduceID == _detailID); SID.StorageInID = Convert.ToInt32(Request.QueryString["StorageInID"]); SID.MaterialID = Convert.ToInt32(this.txtID.Text.Trim()); SID.QuantityGentaojian = Convert.ToDecimal(this.txtGTJ.Text.Trim()); SID.QuantityMetre = Convert.ToDecimal(this.txtMetre.Text.Trim()); SID.QuantityTon = Convert.ToDecimal(this.txtTon.Text.Trim()); if (this.ddlproject.SelectedIndex == 0) { ClientScript.RegisterClientScriptBlock(typeof(string), "ShowMessage", "<script>alert('请选择预期使用项目!')</script>"); return; } SID.ExpectedProject = Convert.ToInt32(this.ddlproject.SelectedValue.Trim()); SID.ExpectedTime = this.DateTimeStorageIn.SelectedDate; if (this.ddlbatch.SelectedItem.Text == "--请选择--") { ClientScript.RegisterClientScriptBlock(typeof(string), "ShowMessage", "<script>alert('请选择入库批次')</script>"); return; } SID.BatchIndex = this.ddlbatch.SelectedItem.Text.ToString(); var SevTime = db.ExecuteQuery <DateTime>("select getdate()", new object[] { }); SID.CreateTime = SevTime.First(); SID.Creator = reEmpId(SPContext.Current.Web.CurrentUser.LoginName); SID.Remark = this.txtRemark.Text.Trim(); db.SubmitChanges(); if (!string.IsNullOrEmpty(Request.QueryString["TaskStorageID"])) { Response.Redirect("StorageDetailedManage.aspx?StorageInID=" + Request.QueryString["StorageInID"] + "&&TaskStorageID=" + Request.QueryString["TaskStorageID"] + ""); } else { Response.Redirect("StorageDetailedManage.aspx?StorageInID=" + Request.QueryString["StorageInID"] + ""); } } } catch (Exception ex) { MethodBase mb = MethodBase.GetCurrentMethod(); LogToDBHelper lhelper = LogToDBHelper.Instance; lhelper.WriteLog(ex.Message, "错误", string.Format("{0}.{1}", mb.ReflectedType.Name, mb.Name)); ClientScript.RegisterClientScriptBlock(typeof(string), "提示", string.Format("<script>alert('{0}')</script>", LogToDBHelper.LOG_MSG_INSERTERROR)); } }
private void BindDefaultDate() { int id = 0; if (!string.IsNullOrEmpty(Request.QueryString["StorageInID"])) { id = Convert.ToInt32(Request.QueryString["StorageInID"]); using (db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString)) { CommitInMain temp = db.CommitInMain.SingleOrDefault(u => u.StorageInID == id); this.txtStorageinNum.Text = temp.StorageInCode.ToString(); this.txtStorageinNum.Enabled = false; //初始化 CommitProduce sp = db.CommitProduce.SingleOrDefault(u => u.StorageInProduceID == _detailID); if (sp != null) { this.txtMaterialCode.Text = sp.MaterialInfo.MaterialName; this.txtMaterialMod.Text = sp.MaterialInfo.SpecificationModel; this.txtID.Text = sp.MaterialID.ToString(); this.txtFinanceCode.Text = sp.MaterialInfo.FinanceCode; this.txtGTJ.Text = sp.QuantityGentaojian.ToString(); this.txtMetre.Text = sp.QuantityMetre.ToString(); this.txtTon.Text = sp.QuantityTon.ToString(); this.ddlproject.SelectedValue = sp.ExpectedProject.ToString(); this.DateTimeStorageIn.SelectedDate = sp.ExpectedTime; this.ddlbatch.Text = sp.BatchIndex.Trim(); this.txtRemark.Text = sp.Remark.Trim(); } } } else { Response.Redirect("StorageManage.aspx"); } }
private bool checkInFlow(string selID) { using (MMSProDBDataContext data = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString)) { CommitProduce sid = data.CommitProduce.SingleOrDefault(u => u.StorageInID == Convert.ToInt32(Request.QueryString["StorageInID"]) && u.StorageInProduceID == Convert.ToInt32(selID)); string CurBatch = sid.BatchIndex; var temp = from a in data.TaskStorageIn where a.StorageInID == Convert.ToInt32(Request.QueryString["StorageInID"]) && a.StorageInType == "委外入库" && a.QCBatch == CurBatch select a; if (temp.ToList().Count > 0) { return(false); } } return(true); }