protected void btnSave_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); DataRow dr = dt.NewRow(); dr["Flag"] = Flag;//旗標 Flag=1 訂單 Flag=2 生產計劃單 dr["BillID"] = this.txtBillID.Text;//單號 if (this.txtBillDate.Text.Length > 0) dr["BillDate"] = this.txtBillDate.Text;//日期 dr["CustomerPO"] = this.txtCustomerPO.Text;//客戶PO dr["EnterpriseID"] = this.txtEnterpriseID.Text;//企業用戶編號 dr["EnterpriseName"] = this.txtEnterpriseName.Text;//企業用戶名稱 dr["Contact"] = this.txtContact.Text;//連絡人員 dr["ContactPhone"] = this.txtContactPhone.Text;//聯絡電話 dr["Fax"] = this.txtFax.Text;//公司傳真 dr["BusPersonID"] = this.txtBusPersonID.Text;//業務員編號 dr["BusPersonName"] = this.txtBusPersonName.Text;//業務員姓名 dr["BillState"] = ddlBillState.SelectedIndex;//單況 0:有效 1:結案 dr["DeliverCountry"] = this.txtDeliverCountry.Text;//送貨地址國別 dr["DeliverAddress"] = this.txtDeliverAddress.Text;//送貨地址 dr["DeliverMehtod"] = this.txtDeliverMehtod.Text;//交貨方式 dr["Memo"] = this.txtMemo.Text;//備註 //dr["TotalPages"] = int.Parse(this.txtTotalPages.Text);//張數合計 if (this.txtCreateDate.Text.Length > 0) dr["CreateDate"] = this.txtCreateDate.Text;//建檔日期 dr["CreateUserName"] = this.txtCreateUserName.Text;//建檔人員 if (this.txtLastModifyDate.Text.Length > 0) dr["LastModifyDate"] = this.txtLastModifyDate.Text;//異動日期 dr["LastModifyUserName"] = this.txtLastModifyUserName.Text;//異動人員 if (this.txtBU_CheckDate.Text.Length > 0) dr["CheckDate"] = this.txtBU_CheckDate.Text;//營運覆核日期 dr["CheckUserName"] = this.txtBU_CheckUserName.Text;//營運覆核人員 if (ID.Length > 0) dal.Update(dr, ID); else dal.Add(dr); DataTable dtSub1 = dal.GetSubDetail("").Tables[0]; DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(HdnSubDetail1.Value); for (int i = 0; i < newdtb.Rows.Count; i++) { DataRow dr1 = dtSub1.NewRow(); dr1["Flag"] = Flag; dr1["BillID"] = this.txtBillID.Text; dr1["EnterpriseID"] = this.txtEnterpriseID.Text; dr1["BillDate"] = this.txtBillDate.DateValue; for (int j = 0; j < newdtb.Columns.Count; j++) { dr1[newdtb.Columns[j].ColumnName] = newdtb.Rows[i][j]; } dtSub1.Rows.Add(dr1); } dtSub1.TableName = "LB_OrderSub"; dal.SaveDetail(dtSub1, ID); Response.Redirect("OrderView.aspx?FormID=" + Server.UrlEncode(FormID) + "&ID=" + Server.UrlEncode(this.txtBillID.Text)); }
protected void btnSave_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); DataRow dr = dt.NewRow(); dr["BillID"] = this.txtBillID.Text;//單號 if (this.txtBillDate.Text.Length > 0) dr["BillDate"] = this.txtBillDate.Text;//日期 dr["StyleID"] = this.txtStyleID1.Value; dr["SourceBillID"] = this.txtSourceBillID.Text; dr["ProducePages"] = this.txtProducePages.Text; dr["StdPages"] = this.txtStdPages.Text; dr["Volumes"] = this.txtVolumes.Text; dr["StartLabelNo"] = this.txtStartLabelNo.Text; dr["EndLabelNo"] = this.txtEndLabelNo.Text; dr["ProductionUnitID"] = this.ddlProductionUnitID.SelectedValue; dr["ScheduleBillID"] = this.txtScheduleBillID.Text; if (this.txtPreInStockDate.Text.Length > 0) dr["PreInStockDate"] = this.txtPreInStockDate.Text; dr["BillState"] = this.ddlBillState.SelectedIndex; if (this.txtCreateDate.Text.Length > 0) dr["CreateDate"] = this.txtCreateDate.Text;//建檔日期 dr["CreateUserName"] = this.txtCreateUserName.Text;//建檔人員 dr["LastModifyDate"] = DateTime.Now;// this.txtLastModifyDate.Text;//異動日期 dr["LastModifyUserName"] = Session["User"].ToString();// this.txtLastModifyUserName.Text;//異動人員 if (this.txtCheckDate.Text.Length > 0) dr["CheckDate"] = this.txtCheckDate.Text;//營運覆核日期 dr["CheckUserName"] = this.txtCheckUserName.Text;//營運覆核用戶 dr["Memo"] = this.txtMemo.Text; if (ID.Length > 0) dal.Update(dr, ID); else dal.Add(dr); DataTable dtSub1 = dal.GetSubDetail("").Tables[0]; DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(HdnSubDetail1.Value); for (int i = 0; i < newdtb.Rows.Count; i++) { DataRow dr1 = dtSub1.NewRow(); dr1["BillID"] = this.txtBillID.Text; //dr1["EnterpriseID"] = this.txtEnterpriseID.Text; dr1["BillDate"] = this.txtBillDate.DateValue; for (int j = 0; j < newdtb.Columns.Count; j++) { dr1[newdtb.Columns[j].ColumnName] = newdtb.Rows[i][j]; } dtSub1.Rows.Add(dr1); } dtSub1.TableName = "LB_ProductionSub"; dal.SaveDetail(dtSub1, ID); Response.Redirect("ProductionView.aspx?FormID=" + Server.UrlEncode(FormID) + "&ID=" + Server.UrlEncode(this.txtBillID.Text)); }
protected void btnSave_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); DataRow dr = dt.NewRow(); dr["AnnounceID"] = this.txtAnnounceID.Text; dr["Announcer"] = this.txtAnnouncer.Text; if (this.txtAnnounceFlag.Text == Resources.Resource.AnnounceFlag1) dr["AnnounceFlag"] = 0; else dr["AnnounceFlag"] = 1; dr["AnnounceUnitNo"] = this.txtAnnounceUnitNo.Text; dr["AnnouncerUserName"] = this.txtAnnouncerUserName.Text; if (this.txtSource.Text == Resources.Resource.AnnounceSource1) dr["Source"] = 0; else dr["Source"] = 1; dr["AnnounceDate"] = DateTime.Now; dr["Title"] = this.txtTitle.Text.Trim(); dr["Contents"] = this.txtContents.Text.Trim(); dal.Add(dr); DataTable dtSub = dal.GetSubDetail("").Tables[0]; for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb.Checked) { DataRow subdr = dtSub.NewRow(); subdr["AnnounceID"] = this.txtAnnounceID.Text; subdr["ReceiverUserName"] = this.GridView1.Rows[i].Cells[1].Text; if (this.GridView1.Rows[i].Cells[2].Text == Resources.Resource.AnnounceFlag1) subdr["ReceiverFlag"] = 0; else subdr["ReceiverFlag"] = 1; subdr["ReceiveUnitNo"] = this.GridView1.Rows[i].Cells[3].Text; subdr["Receiver"] = this.GridView1.Rows[i].Cells[4].Text; dtSub.Rows.Add(subdr); } } dal.SaveDetail(dtSub, ""); Response.Redirect("AnnounceMessageView.aspx?FormID=" + Server.UrlEncode(FormID) + "&ID=" + Server.UrlEncode(this.txtAnnounceID.Text)); }
//protected void btnLimitedProduct_Click(object sender, EventArgs e) //{ // //Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); // //DataTable dtSub1 = dal.GetSubDetail("").Tables[0]; // DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(HdnSubDetail1.Value); // DataColumn dc; // dc = new DataColumn("ID", typeof(string)); // newdtb.Columns.Add(dc); // dc = new DataColumn("StyleID", typeof(string)); // newdtb.Columns.Add(dc); // dc = new DataColumn("EnterpriseID", typeof(string)); // newdtb.Columns.Add(dc); // for (int i = 0; i < newdtb.Rows.Count; i++) // { // newdtb.Rows[i]["ID"] = txtStyleID.Value; // newdtb.Rows[i]["StyleID"] = this.txtStyleID1.Text; // // newdtb.Rows[i]["EnterpriseID"] = this.txtEnterpriseID.Text; // } // newdtb.TableName = "LB_StyleSub"; // new Js.DAO.SubBaseDao(cnKey).Save(newdtb, " ID ='" + ID + "'"); // ScriptManager.RegisterStartupScript(this.updatePanel, this.GetType(), "Resize", "content_resize();initial();", true); //} protected void btnStylePages_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dtSub1 = dal.GetSubDetail(this.txtStyleID.Text).Tables[0]; DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(HdnSubDetail1.Value); for (int i = 0; i < newdtb.Rows.Count; i++) { DataRow dr1 = dtSub1.Rows[i]; for (int j = 0; j < newdtb.Columns.Count; j++) { dr1[newdtb.Columns[j].ColumnName] = newdtb.Rows[i][j]; } } dtSub1.TableName = "LB_WarehousePages"; dal.SaveDetail(dtSub1, this.txtStyleID.Text); }
protected void btnSave_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); DataRow dr = dt.NewRow(); dr["EnterpriseID"] = this.txtEnterpriseID.Text; dr["CategoryID"] = this.ddlCategoryID.SelectedValue.ToString(); dr["EnterpriseName"] = this.txtEnterpriseName.Text; dr["EnterpriseEName"] = this.txtEnterpriseEName.Text; dr["EnterpriseSName"] = this.txtEnterpriseSName.Text; dr["UnionID"] = this.txtUnionID.Text; //dr["LabelFrom"] = this.rbtLabelFromYes.Checked; dr["President"] = this.txtPresident.Text; //dr["PresidentPost"] = this.txtPresidentPost.Text; dr["Phone"] = this.txtPhone.Text; dr["Fax"] = this.txtFax.Text; //dr["Contact"] = this.txtContact.Text; //dr["ContactPost"] = this.txtContactPost.Text; //dr["ContactPhone"] = this.txtContactPhone.Text; //dr["CellPhone"] = this.txtCellPhone.Text; //dr["Email"] = this.txtEmail.Text; dr["WebUrl"] = this.txtWebUrl.Text; dr["Address"] = this.txtAddress.Text; dr["ZipNo"] = this.txtZipNo.Text; byte ServiceYears; byte.TryParse(this.txtServiceYears.Text.Trim(), out ServiceYears); this.txtServiceYears.Text = ServiceYears.ToString(); dr["ServiceYears"] = ServiceYears; dr["EnableMonths"] = byte.Parse(this.ddlEnableMonths.Text); dr["Memo"] = this.txtMemo.Text.Trim(); dr["CreateUserName"] = this.txtCreateUserName.Text; dr["CreateDate"] = this.txtCreateDate.Text; dr["LastModifyUserName"] = Session["User"].ToString(); dr["LastModifyDate"] = DateTime.Now.ToString(Js.Com.User.strDateFormat); dr["CheckUserName"] = this.txtCheckUserName.Text; if (this.txtCheckDate.Text.Length > 0) dr["CheckDate"] = this.txtCheckDate.Text; if (ID.Length > 0) { Js.BLL.BusinessUnit.EnterpriseDal edal = new Js.BLL.BusinessUnit.EnterpriseDal(); Js.Model.BusinessUnit.EnterpriseInfo model = edal.GetModel(ID); if (ServiceYears != model.ServiceYears || this.ddlEnableMonths.Text != model.EnableMonths.ToString()) { edal.InsertModifyRecord(ID, ServiceYears, byte.Parse(this.ddlEnableMonths.Text)); } dal.Update(dr, ID); } else dal.Add(dr); ////同步更新企業庫裡的這筆資料 //Js.BLL.BaseDal edal = new Js.BLL.BaseDal("EP_Enterprise", this.txtEnterpriseID.Text); //if (edal.Exists(this.txtEnterpriseID.Text)) // edal.Update(dr,ID); //else // edal.Add(dr); DataTable dtSub1 = dal.GetSubDetail("").Tables[0]; DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(this.HdnSubDetail1.Value); for (int i = 0; i < newdtb.Rows.Count; i++) { DataRow subdr = dtSub1.NewRow(); subdr["EnterpriseID"] = this.txtEnterpriseID.Text; for (int j = 0; j < newdtb.Columns.Count; j++) { subdr[newdtb.Columns[j].ColumnName] = newdtb.Rows[i][j]; } if (ID.Length > 0) { subdr["LastModifyDate"] = DateTime.Now.ToString(Js.Com.User.strDateFormat); subdr["LastModifyUserName"] = Session["User"].ToString(); } else { subdr["CreateUserName"] = this.txtCreateUserName.Text; subdr["CreateDate"] = this.txtCreateDate.Text; subdr["LastModifyDate"] = DateTime.Now.ToString(Js.Com.User.strDateFormat); subdr["LastModifyUserName"] = Session["User"].ToString(); } dtSub1.Rows.Add(subdr); } dal.SaveDetail(dtSub1, ID); //dtSub1.TableName = "EP_EnterpriseLinkMan"; //edal.SaveDetail(dtSub1, ID); Response.Redirect("EnterpriseView.aspx?FormID=" + Server.UrlEncode(FormID) + "&ID=" + Server.UrlEncode(this.txtEnterpriseID.Text)); }
protected void btnOrdPreNO_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dtSub1 = dal.GetSubDetail(this.txtBillID.Text).Tables[0]; DataTable newdtb = Js.Com.JsonHelper.Json2Dtb(HdnSubDetail1.Value); for (int i = 0; i < newdtb.Rows.Count; i++) { DataRow dr1 = dtSub1.Rows[i]; for (int j = 0; j < newdtb.Columns.Count; j++) { dr1[newdtb.Columns[j].ColumnName] = newdtb.Rows[i][j]; } } dtSub1.TableName = "LB_OrderSub"; dal.SaveDetail(dtSub1, this.txtBillID.Text); if (((Button)sender).ClientID == "btnCancelOrdNo") new Js.DAO.Label.OrderDao(FormID, cnKey).updateBillState(this.txtBillID.Text); DataTable dt = dal.GetViewRecord(string.Format(_strWhere, this.txtBillID.Text)); BindData(dt); //Response.Redirect("OrderView.aspx?FormID=" + Server.UrlEncode(FormID) + "&ID=" + Server.UrlEncode(this.txtBillID.Text)); }
public static void SystemMessage(string[] ToUserName, int ReceiverFlag, string[] ReceiveUnitNo, string Title, string Content) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal("Sys_AnnounceMessage"); string strAnnounceUnitNo = ""; string strAnnounceID = ""; string strAnnouncer = ""; string strWhere = " AnnounceID like '" + strAnnounceUnitNo + DateTime.Now.ToString("yyyyMMdd") + "%'"; dal.GetMaxID(strWhere); strAnnounceID = dal.GetMaxID(strWhere); if (strAnnounceID.Length <= 0) strAnnounceID = strAnnounceUnitNo + DateTime.Now.ToString("yyyyMMdd") + "0001"; if (HttpContext.Current.Session["UserType"].ToString() == "BU") { Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal(); Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel(); strAnnounceUnitNo = model.CompanyNo; Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(); Js.Model.Account.UsersInfo umodel = udal.GetModel(HttpContext.Current.Session["User"].ToString()); strAnnouncer = umodel.PersonName; } else { strAnnounceUnitNo = HttpContext.Current.Session["EnterpriseID"].ToString(); Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(HttpContext.Current.Session["EnterpriseID"].ToString()); Js.Model.Account.UsersInfo umodel = udal.GetModel(HttpContext.Current.Session["User"].ToString()); strAnnouncer = umodel.PersonName; } DataTable dt = dal.GetRecord("1=2"); DataRow dr = dt.NewRow(); dr["AnnounceID"] = strAnnounceID; dr["Announcer"] = strAnnouncer; if (HttpContext.Current.Session["UserType"].ToString() == "BU") dr["AnnounceFlag"] = 0; else dr["AnnounceFlag"] = 1; dr["AnnounceUnitNo"] = strAnnounceUnitNo; dr["AnnouncerUserName"] = HttpContext.Current.Session["User"].ToString(); dr["Source"] = 1; dr["AnnounceDate"] = DateTime.Now; dr["Title"] = Title; dr["Contents"] = Content; dal.Add(dr); DataTable dtSub = dal.GetSubDetail("").Tables[0]; for (int i = 0; i < ToUserName.Length; i++) { DataRow subdr = dtSub.NewRow(); subdr["AnnounceID"] = strAnnounceID; subdr["ReceiverUserName"] = ToUserName[i]; subdr["ReceiverFlag"] = ReceiverFlag; subdr["ReceiveUnitNo"] = ReceiveUnitNo[i]; Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(ReceiveUnitNo[i]); Js.Model.Account.UsersInfo umodel = udal.GetModel(ToUserName[i]); subdr["Receiver"] = umodel.PersonName; dtSub.Rows.Add(subdr); } dal.SaveDetail(dtSub, ""); }