private void BindDropDown() { // 默认下一环节 EWF_Flow_AppBLL app = new EWF_Flow_AppBLL((Guid)ViewState["AppID"]); lb_AppName.Text = app.Model.Name; ddl_DefaultNextProcess.DataSource = app.GetProcessList(); ddl_DefaultNextProcess.DataBind(); ddl_DefaultNextProcess.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); ddl_Type.DataSource = DictionaryBLL.GetDicCollections("EWF_Flow_ProcessType"); ddl_Type.DataBind(); ddl_Type.SelectedValue = "7"; ddl_DataObject_Position.DataSource = app.GetDataObjectList(); ddl_DataObject_Position.DataBind(); ddl_DataObject_Position.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); }
private void BindData(int ID) { ViewState["ID"] = ID; Addr_OfficialCityBLL _bll = new Addr_OfficialCityBLL(ID); lbl_ID.Text = _bll.Model.ID.ToString(); tbx_Name.Text = _bll.Model.Name; tree_SuperID.SelectValue = _bll.Model.SuperID.ToString(); tbx_Code.Text = _bll.Model.Code; tbx_CallAreaCode.Text = _bll.Model.CallAreaCode; tbx_PostCode.Text = _bll.Model.PostCode; tbx_Births.Text = _bll.Model.Births.ToString(); ddl_CityAttributeFlag.SelectedValue = _bll.Model.Attribute.ToString(); if (_bll.Model.Level != 0) { lbl_LevelName.Text = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel")[_bll.Model.Level.ToString()].Name; } btn_Save.Text = "修改"; btn_Save.ForeColor = System.Drawing.Color.Red; btn_Delete.Visible = true; MessageBox.ShowConfirm(btn_Delete, "数据删除将不可恢复,确定删除么?"); btn_Cancel.Visible = true; bt_AddSub.Visible = true; lbl_AlertInfo.Text = ""; if ((int)ViewState["ID"] == 1) { btn_Save.Enabled = false; } else { btn_Save.Enabled = true; } btn_Delete.Visible = Addr_OfficialCityBLL.GetModelList("SuperID=" + ViewState["ID"].ToString()).Count == 0; BindOfficialPopulation(); }
private void BindDropDown() { Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } ddl_JournalType.DataSource = DictionaryBLL.GetDicCollections("OA_JournalType"); ddl_JournalType.DataBind(); ddl_JournalType.Items.Insert(0, new ListItem("请选择...", "0")); #region 绑定职位 tr_Position.DataSource = Org_PositionBLL.GetAllPostion(); tr_Position.DataBind(); #region 如果非总部职位,其只能选择自己职位及以下职位 if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 22, "ViewAllStaffJN")) { //有【查看所有员工工作日志】权限 tr_Position.RootValue = "0"; tr_Position.SelectValue = "0"; } else { tr_Position.RootValue = staff.Model.Position.ToString(); tr_Position.SelectValue = staff.Model.Position.ToString(); } #endregion #endregion }
/// <summary> /// 根据核销单是否有申请单、是否差旅行程报销单、状态,设置GridView列的显示式及三个编辑按钮的显示 /// </summary> /// <param name="HasFeeApply">是否有申请单</param> /// <param name="IsEvectionWriteOff">是否差旅行程报销单</param> /// <param name="State">状态</param> private void SetGridViewColumnAndButton(bool HasFeeApply, bool IsEvectionWriteOff, int State) { if (HasFeeApply) { //有费用申请 bt_EditWriteOffDetail.OnClientClick = "PopEditFeeDetail(" + ViewState["FeeType"].ToString() + "," + ViewState["OrganizeCity"].ToString() + "," + ViewState["FeeApplyClient"].ToString() + ")"; bt_AddTitleNoApply.Visible = false; bt_EditEvectionRoute.Visible = false; } else { if (State == 1 && DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()].Description == "BudgetControl") { BindBudgetInfo(); } //当费用为无申请费用时,下列字段隐藏 gv_List.Columns[0].Visible = false; //申请单备案号 gv_List.Columns[1].Visible = false; //发生客户 gv_List.Columns[3].Visible = false; //可核销额 gv_List.Columns[6].Visible = false; //结余方式 bt_AddTitleNoApply.OnClientClick = "PopTitleNoApply(" + ViewState["FeeType"].ToString() + "," + ViewState["OrganizeCity"].ToString() + ")"; bt_EditWriteOffDetail.Visible = false; } if (IsEvectionWriteOff) { //当核销单关联至差旅行程报销时,下列字段隐藏 gv_List.Columns[gv_List.Columns.Count - 1].Visible = false; //不可删除单项科目 gv_List.Columns[7].Visible = false; //备注 bt_EditEvectionRoute.OnClientClick = "PopEditEvectionRoute(" + ViewState["ID"].ToString() + ")"; bt_EditWriteOffDetail.Visible = false; bt_AddTitleNoApply.Visible = false; } else { bt_EditEvectionRoute.Visible = false; } }
public string GetSalesVolume(int Product) { PDT_Product p = new PDT_ProductBLL(Product).Model; IList <SVM_JXCSummary> jxclist = SVM_JXCSummaryBLL.GetModelList("AccountMonth=" + ((int)ViewState["Month"] - 1).ToString() + " AND Client=" + ViewState["ClientID"].ToString() + " AND Product=" + Product.ToString()); if (jxclist.Count != 1) { return(""); } int quantity = jxclist[0].PurchaseVolume; if (quantity == 0) { return("0"); } string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); return((quantity / p.ConvertFactor).ToString() + packing1 + " " + (quantity % p.ConvertFactor).ToString() + packing2); }
private void BindDropDown() { #region 绑定用户可管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion ddl_PositionType.DataSource = DictionaryBLL.GetDicCollections("PUB_PositionType"); ddl_PositionType.DataBind(); ddl_PositionType.Items.Insert(0, new ListItem("请选择", "0")); }
private void BindDropDown() { Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } ddl_Classify.DataSource = DictionaryBLL.GetDicCollections("CAT_Classify"); ddl_Classify.DataBind(); ddl_Classify.Items.Insert(0, new ListItem("请选择...", "0")); }
private void BindDropDown() { Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } tr_Position.DataSource = Org_PositionBLL.GetAllPostion(); #region 如果非总部职位,其只能选择自己职位及以下职位 Org_Position p = new Org_PositionBLL(staff.Model.Position).Model; if (p != null && p.IsHeadOffice != "Y" && p.Remark != "OfficeHR") { //tr_Position.RootValue = staff.Model.Position.ToString();// p.SuperID.ToString(); tr_Position.RootValue = p.SuperID.ToString(); tr_Position.SelectValue = staff.Model.Position.ToString(); } else { tr_Position.RootValue = "1"; //tr_Position.SelectValue = "1"; } tr_Position.SelectValue = tr_Position.RootValue; #endregion ddl_ApproveFlag.DataSource = DictionaryBLL.GetDicCollections("PUB_ApproveFlag"); ddl_ApproveFlag.DataBind(); ddl_ApproveFlag.Items.Insert(0, new ListItem("所有", "0")); ddl_ApproveFlag.SelectedValue = "1"; }
private void BindDropDown() { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } tr_OrganizeCity_Selected(null, null); #endregion ddl_Month.DataSource = AC_AccountMonthBLL.GetModelList(""); ddl_Month.DataBind(); ddl_Month.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now).ToString(); ddl_State.DataSource = DictionaryBLL.GetDicCollections("ORD_OrderApplyState"); ddl_State.DataBind(); ddl_State.Items.Insert(0, new ListItem("全部", "0")); IList <PDT_Brand> _brandList = PDT_BrandBLL.GetModelList("IsOpponent=1"); ddl_Brand.DataTextField = "Name"; ddl_Brand.DataValueField = "ID"; ddl_Brand.DataSource = _brandList; ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("全部", "0")); ddl_Classify.Items.Insert(0, new ListItem("所有", "0")); ddl_ProductType.DataSource = DictionaryBLL.GetDicCollections("ORD_ProductOrderType"); ddl_ProductType.DataBind(); ddl_ProductType.Items.Insert(0, new ListItem("全部", "0")); }
private void BindGrid() { UploadFile1.RelateID = int.Parse(select_Client.SelectValue); UploadFile1.BeginTime = DateTime.Parse(this.tbx_begin.Text); UploadFile1.EndTime = DateTime.Parse(this.tbx_end.Text).AddDays(1); CM_ClientBLL client = new CM_ClientBLL(UploadFile1.RelateID); if (client.Model.ClientType == 2 && client.Model["ContractProve"] != null) { string Atmts = ""; foreach (string _c in client.Model["ContractProve"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { Atmts += DictionaryBLL.GetDicCollections("CM-ContractProve")[_c].Name + ","; } if (Atmts != "") { lbl_message.Text = "该经销商必须上传以下附件," + Atmts + "并在【名称】中填相应附件名"; } } string extcondition = ""; if (tbx_FindName.Text != "") { extcondition = " Name like '%" + tbx_FindName.Text + "%' "; } if (cb_OnlyPic.Checked) { if (extcondition != "") { extcondition += " AND "; } extcondition += "lower(ExtName) in ('bmp','jpg','gif','png')"; } UploadFile1.ExtCondition = extcondition; UploadFile1.BindGrid(); }
private void BindDropdown() { //获取品牌 ddl_Brand.DataSource = PDT_BrandBLL.GetModelList("IsOpponent=" + ViewState["IsOpponent"].ToString()); ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("所有", "0")); ddl_Brand_SelectedIndexChanged(null, null); rbl_ApproveFlag.DataSource = DictionaryBLL.GetDicCollections("PUB_ApproveFlag"); rbl_ApproveFlag.DataBind(); rbl_ApproveFlag.Items.Insert(0, new ListItem("所有", "0")); rbl_ApproveFlag.SelectedValue = "0"; ddl_Grade.DataSource = DictionaryBLL.GetDicCollections("PDT_Grade"); ddl_Grade.DataBind(); ddl_Grade.Items.Insert(0, new ListItem("所有", "0")); ddl_Grade.SelectedValue = "0"; rbl_State.DataSource = DictionaryBLL.GetDicCollections("PDT_State"); rbl_State.DataBind(); rbl_State.SelectedValue = "1"; }
private void BindDropDown() { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } tr_OrganizeCity_Selected(null, null); #endregion int forwarddays = ConfigHelper.GetConfigInt("FeeApplyForwardDays"); ddl_ApplyMonth.DataSource = AC_AccountMonthBLL.GetModelList("EndDate>=GETDATE() AND BeginDate<='" + DateTime.Today.AddDays(forwarddays).ToString("yyyy-MM-dd") + "' AND Year>=" + (DateTime.Today.Year - 1).ToString()); ddl_ApplyMonth.DataBind(); ddl_ApplyMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(forwarddays)).ToString(); rbl_GiftClassify.DataSource = DictionaryBLL.GetDicCollections("ORD_GiftClassify"); rbl_GiftClassify.DataBind(); rbl_GiftClassify.SelectedValue = "1"; ddl_AccountTitle.DataSource = AC_AccountTitleBLL.GetListByFeeType((int)ViewState["GiftFeeType"]); ddl_AccountTitle.DataBind(); ddl_LastWriteOffMonth.DataSource = AC_AccountMonthBLL.GetModelList("BeginDate>=GETDATE() AND BeginDate<DATEADD(month,5,GETDATE())"); ddl_LastWriteOffMonth.DataBind(); ddl_Brand.DataSource = PDT_BrandBLL.GetModelList("IsOpponent='1'"); ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("请选择...", "0")); }
private void BindDropDown() { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } if ((int)ViewState["OrganizeCity"] > 0) { tr_OrganizeCity.SelectValue = ViewState["OrganizeCity"].ToString(); } #endregion int forwarddays = ConfigHelper.GetConfigInt("FeeApplyForwardDays"); ddl_Month.DataSource = AC_AccountMonthBLL.GetModelList("BeginDate<='" + DateTime.Today.AddDays(forwarddays).ToString("yyyy-MM-dd") + "' AND Year>=" + (DateTime.Today.Year - 1).ToString()); ddl_Month.DataBind(); ddl_Month.SelectedValue = (int)ViewState["AccountMonth"] == 0 ? AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(forwarddays)).ToString() : ViewState["AccountMonth"].ToString(); ddl_RTChannel.DataSource = DictionaryBLL.GetDicCollections("CM_RT_Channel"); ddl_RTChannel.DataBind(); ddl_RTChannel.Items.Insert(0, new ListItem("所有", "0")); ddl_RTChannel.SelectedValue = "0"; ddl_RTType.DataSource = DictionaryBLL.GetDicCollections("CM_RT_Classify"); ddl_RTType.DataBind(); ddl_RTType.Items.Insert(0, new ListItem("所有", "0")); ddl_RTType.SelectedValue = "0"; }
private void BindDropDown() { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } tr_OrganizeCity_Selected(null, null); #endregion int forwarddays = ConfigHelper.GetConfigInt("FeeApplyForwardDays"); ddl_AccountMonth.DataSource = AC_AccountMonthBLL.GetModelList("EndDate>=GETDATE() AND BeginDate<='" + DateTime.Today.AddDays(forwarddays).ToString("yyyy-MM-dd") + "' AND Year>=" + (DateTime.Today.Year - 1).ToString()); ddl_AccountMonth.DataBind(); ddl_AccountMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(forwarddays)).ToString(); ddl_FeeType.DataSource = DictionaryBLL.GetDicCollections("FNA_FeeType").OrderBy(p => p.Value.Name).ToList(); ddl_FeeType.DataBind(); ddl_FeeType.SelectedValue = ConfigHelper.GetConfigInt("CarFeeType").ToString(); ddl_FeeType.Enabled = false; //foreach (ListItem item in ddl_FeeType.Items) //{ // if (AC_AccountTitleBLL.GetListByFeeType(int.Parse(item.Value)).Where(p => p.ID > 1).ToList().Count == 0) // { // item.Enabled = false; // } //} }
private void BindDropDown() { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion rbl_FeeType.DataSource = DictionaryBLL.GetDicCollections("FNA_FeeType").OrderBy(p => p.Value.Name).ToList(); rbl_FeeType.DataBind(); foreach (ListItem item in rbl_FeeType.Items) { if (AC_AccountTitleBLL.GetListByFeeType(int.Parse(item.Value)).Where(p => p.ID > 1).ToList().Count == 0) { item.Enabled = false; } } rbl_FeeType.Items.Insert(0, new ListItem("请选择", "0")); ddl_InvoiceClassAB.DataSource = DictionaryBLL.GetDicCollections("FNA_InvoiceClassAB").OrderBy(p => p.Value.Name).ToList(); ddl_InvoiceClassAB.DataBind(); ddl_InvoiceClassAB.Items.Insert(0, new ListItem("请选择", "0")); //select_Client.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=2&OrganizeCity=" + tr_OrganizeCity.SelectValue + "&ExtCondition=\"MCS_SYS.dbo.UF_Spilt(CM_Client.ExtPropertys,~|~,7) IN (1,3)\""; //select_Staff.PageUrl = "~/SubModule/StaffManage/Pop_Search_Staff.aspx?OrganizeCity=" + tr_OrganizeCity.SelectValue; }
private void BindDropDown() { #region 绑定用户可管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } tr_OrganizeCity_Selected(null, null); #endregion rbl_ApproveFlag.DataSource = DictionaryBLL.GetDicCollections("PUB_ApproveFlag"); rbl_ApproveFlag.DataBind(); rbl_ApproveFlag.Items.Insert(0, new ListItem("所有", "0")); rbl_ApproveFlag.SelectedValue = "0"; }
private void BindDropDown() { EWF_Flow_AppBLL app = new EWF_Flow_AppBLL((Guid)ViewState["AppID"]); lb_AppName.Text = app.Model.Name; // 默认下一环节 ddl_DefaultNextProcess.DataSource = app.GetProcessList(); ddl_DefaultNextProcess.DataBind(); ddl_DefaultNextProcess.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); //环节类型 ddl_Type.DataSource = DictionaryBLL.GetDicCollections("EWF_Flow_ProcessType"); ddl_Type.DataBind(); this.ddl_Type.SelectedValue = "9"; ddl_RecipientRole_Decision.DataSource = EWF_RoleBLL.GetModelList(""); ddl_RecipientRole_Decision.DataBind(); ddl_RecipientRole_Decision.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); ddl_DataObject_Decision.DataSource = app.GetDataObjectList(); ddl_DataObject_Decision.DataBind(); ddl_DataObject_Decision.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); }
private void BindPublish() { if (tr_OrganizeCity.SelectValue != "0") { DataTable dt = TreeTableBLL.GetFullPath("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "SuperID", int.Parse(tr_OrganizeCity.SelectValue)); string citys = ""; for (int i = 0; i < dt.Rows.Count; i++) { citys += dt.Rows[i]["ID"].ToString(); if (i < dt.Rows.Count - 1) { citys += ","; } } if (rbl_Type.SelectedValue == "1") { ddl_OrderType.DataSource = DictionaryBLL.GetDicCollections("ORD_ProductOrderType"); ddl_OrderType.DataTextField = "Value"; ddl_OrderType.DataValueField = "Key"; ddl_OrderType.DataBind(); rbl_IsSpecial.DataSource = DictionaryBLL.GetDicCollections("PUB_YesOrNo"); rbl_IsSpecial.DataBind(); rbl_IsSpecial.SelectedValue = "2"; IList <PDT_Brand> _brandList = PDT_BrandBLL.GetModelList("IsOpponent=1"); ddl_Brand.DataTextField = "Name"; ddl_Brand.DataValueField = "ID"; ddl_Brand.DataSource = _brandList; ddl_Brand.DataBind(); ddl_Brand_SelectedIndexChanged(null, null); } } }
protected string GetQuantityString(int product, int quantity) { if (quantity == 0) { return("0"); } PDT_Product p = new PDT_ProductBLL(product, true).Model; string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); string ret = ""; if (quantity / p.ConvertFactor != 0) { ret += (quantity / p.ConvertFactor).ToString() + packing1 + " "; } if (quantity % p.ConvertFactor != 0) { ret += (quantity % p.ConvertFactor).ToString() + packing2 + " "; } return(ret); }
protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { if (tr_OrganizeCity.SelectValue != "0") { Addr_OrganizeCity city = new Addr_OrganizeCityBLL((int.Parse(tr_OrganizeCity.SelectValue))).Model; ddl_Level.DataSource = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel").Where(p => int.Parse(p.Key) >= city.Level).ToList().OrderBy(p => p.Key); ddl_Level.DataBind(); if (ddl_Level.Items.Count == 0) { ddl_Level.Items.Add(new ListItem("本级", city.Level.ToString())); } int level = city.Level + 1; if (city.Level == 3) { level = city.Level + 2; } if (ddl_Level.Items.FindByValue(level.ToString()) != null) { ddl_Level.SelectedValue = level.ToString(); } } }
private void FillModel(PDT_Product m, int TDP) { ID = m.ID; FullName = m.FullName; ShortName = m.ShortName; Code = m.Code; BarCode = m.BarCode; BoxBarCode = m.BoxBarCode; ConvertFactor = m.ConvertFactor; Spec = m.Spec; Remark = m.Remark; Grade = m.Grade; Category = m.Category; FactoryCode = m.FactoryCode; FactoryName = m.FactoryName; #region 获取商品的TDP扩展管理信息 if (TDP != 0) { IList <PDT_ProductExtInfo> exts = PDT_ProductExtInfoBLL.GetModelList("Supplier=" + TDP.ToString() + " AND Product=" + m.ID.ToString()); if (exts.Count > 0) { TDPCode = exts[0].Code; if (exts[0].Category != 0) { Category = exts[0].Category; } BuyPrice = exts[0].BuyPrice; SalesPrice = exts[0].SalesPrice; } } #endregion #region 获取品牌、系列、类别名称 if (m.Brand > 0) { PDT_Brand brand = new PDT_BrandBLL(m.Brand).Model; if (brand != null) { BrandName = brand.Name; } } if (m.Classify > 0) { PDT_Classify classify = new PDT_ClassifyBLL(m.Classify).Model; if (classify != null) { ClassifyName = classify.Name; } } if (Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(Category); } #endregion #region 获取字典表名称 try { if (m.Grade > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Grade")[m.Grade.ToString()]; if (dic != null) { GradeName = dic.Name; } } if (m.TrafficPackaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.TrafficPackaging.ToString()]; if (dic != null) { TrafficPackagingName = dic.Name; } } if (m.Packaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.Packaging.ToString()]; if (dic != null) { PackagingName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Product", err); } #endregion #region 获取首要图片 string condition = " RelateType=11 AND RelateID=" + m.ID.ToString() + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',1)='Y'"; IList <ATMT_Attachment> lists = ATMT_AttachmentBLL.GetModelList(condition); if (lists.Count > 0 && ATMT_AttachmentBLL.IsImage(lists[0].ExtName)) { ImageGUID = lists[0].GUID; } #endregion #region 获取附件明细 Atts = new List <Attachment>(); IList <ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(11, m.ID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1)); foreach (ATMT_Attachment item in atts.OrderBy(p => p.Name)) { Atts.Add(new Attachment(item)); } #endregion }
protected string GetTrafficeName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; return(DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString()); }
protected void bt_DownloadTemplate_Click(object sender, EventArgs e) { #region 获取最迟的销量日期 int JXCDelayDays = ConfigHelper.GetConfigInt("JXCDelayDays"); AC_AccountMonth month = new AC_AccountMonthBLL(AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(-JXCDelayDays))).Model; DateTime day = DateTime.Today < month.EndDate ? DateTime.Today : month.EndDate; #endregion #region 判断有无选择业代 if (string.IsNullOrEmpty(select_Staff.SelectValue) || select_Staff.SelectValue == "0") { MessageBox.Show(this, "对不起,请选择责任业代!"); return; } #endregion #region 获取业代负责的零售商及所有产品数据 int staff = int.Parse(select_Staff.SelectValue); IList <CM_Client> clientlists = CM_ClientBLL.GetModelList("ClientType=3 AND ClientManager=" + staff.ToString() + " AND ActiveFlag=1 AND ApproveFlag=1 AND OpenTime<'" + day.ToString("yyyy-MM-dd") + " 23:59:59' ORDER BY Code"); if (clientlists.Count == 0) { MessageBox.Show(this, "对不起,没有当前人直接负责的终端店!"); return; } IList <PDT_Product> productlists = PDT_ProductBLL.GetModelList("Brand IN (SELECT ID FROM dbo.PDT_Brand WHERE IsOpponent='1') AND State=1 AND ApproveFlag=1 ORDER BY ISNULL(SubUnit,999999),Code"); #endregion #region 组织文件路径及文件名 string path = ConfigHelper.GetConfigString("AttachmentPath"); if (path.StartsWith("~")) { path = Server.MapPath(path); } if (!path.EndsWith("\\")) { path = path + "\\"; } path += "ImportExcelSVM\\Download\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filename = "销量导入模板-" + select_Staff.SelectText + "-" + DateTime.Today.ToString("yyyyMMdd") + ".xls"; path += filename; #endregion #region 生成Excel文件 object missing = System.Reflection.Missing.Value; ApplicationClass ExcelApp = null; try { ExcelApp = new ApplicationClass(); ExcelApp.Visible = false; ExcelApp.DisplayAlerts = false; Workbook workbook1 = null; Worksheet worksheet1 = null, worksheet2 = null; try { workbook1 = ExcelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); worksheet1 = (Worksheet)workbook1.Worksheets["sheet1"]; worksheet2 = (Worksheet)workbook1.Worksheets.Add(missing, worksheet1, 1, missing); worksheet1.Name = "零售商进货"; worksheet2.Name = "零售商销货"; #region 创建表头 worksheet1.Cells[1, 1] = "零售商ID"; worksheet1.Cells[1, 2] = "零售商编号"; worksheet1.Cells[1, 3] = "零售商名称"; worksheet1.Cells[1, 4] = "零售商分类"; worksheet1.Cells[1, 5] = "归属月份"; worksheet1.get_Range("B2", "B2").ColumnWidth = 15; worksheet1.get_Range("C2", "C2").ColumnWidth = 20; worksheet1.get_Range("D2", "E2").ColumnWidth = 10; worksheet1.get_Range("A1", "A1").RowHeight = 50; worksheet1.get_Range("A1", "CC1").WrapText = true; worksheet1.get_Range("A1", "CC1").Font.Bold = true; worksheet1.get_Range("A1", "CC1000").Font.Size = 9; worksheet1.get_Range("A1", "CC1000").HorizontalAlignment = XlHAlign.xlHAlignCenter; worksheet2.Cells[1, 1] = "零售商ID"; worksheet2.Cells[1, 2] = "零售商编号"; worksheet2.Cells[1, 3] = "零售商名称"; worksheet2.Cells[1, 4] = "零售商分类"; worksheet2.Cells[1, 5] = "归属月份"; worksheet2.Cells[1, 6] = "导购ID"; worksheet2.Cells[1, 7] = "导购姓名"; worksheet2.get_Range("B2", "B2").ColumnWidth = 15; worksheet2.get_Range("C2", "C2").ColumnWidth = 20; worksheet2.get_Range("D2", "G2").ColumnWidth = 10; worksheet2.get_Range("A1", "A1").RowHeight = 50; worksheet2.get_Range("A1", "CC1").WrapText = true; worksheet2.get_Range("A1", "CC1").Font.Bold = true; worksheet2.get_Range("A1", "CC1000").Font.Size = 9; worksheet2.get_Range("A1", "CC1000").HorizontalAlignment = XlHAlign.xlHAlignCenter; int bgcolor1 = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.LightYellow); int bgcolor2 = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.LightGreen); //将产品写入表头 for (int i = 0; i < productlists.Count; i++) { worksheet1.Cells[1, 6 + i] = productlists[i].ShortName; worksheet2.Cells[1, 8 + i] = productlists[i].ShortName; #region 品牌设置产品列颜色 if (i > 0) { if (productlists[i].Brand == productlists[i - 1].Brand) { worksheet1.get_Range(worksheet1.Cells[1, 6 + i], worksheet1.Cells[1000, 6 + i]).Interior.Color = worksheet1.get_Range(worksheet1.Cells[1, 6 + i - 1], worksheet1.Cells[1000, 6 + i - 1]).Interior.Color; worksheet2.get_Range(worksheet2.Cells[1, 8 + i], worksheet2.Cells[1000, 8 + i]).Interior.Color = worksheet2.get_Range(worksheet2.Cells[1, 8 + i - 1], worksheet2.Cells[1000, 8 + i - 1]).Interior.Color; } else { if (int.Parse(worksheet1.get_Range(worksheet1.Cells[1, 6 + i - 1], worksheet1.Cells[1000, 6 + i - 1]).Interior.Color.ToString()) == bgcolor1) { worksheet1.get_Range(worksheet1.Cells[1, 6 + i], worksheet1.Cells[1000, 6 + i]).Interior.Color = bgcolor2; } else { worksheet1.get_Range(worksheet1.Cells[1, 6 + i], worksheet1.Cells[1000, 6 + i]).Interior.Color = bgcolor1; } if (int.Parse(worksheet2.get_Range(worksheet2.Cells[1, 8 + i - 1], worksheet2.Cells[1000, 8 + i - 1]).Interior.Color.ToString()) == bgcolor1) { worksheet2.get_Range(worksheet2.Cells[1, 8 + i], worksheet2.Cells[1000, 8 + i]).Interior.Color = bgcolor2; } else { worksheet2.get_Range(worksheet2.Cells[1, 8 + i], worksheet2.Cells[1000, 8 + i]).Interior.Color = bgcolor1; } } } else { worksheet1.get_Range(worksheet1.Cells[1, 6 + i], worksheet1.Cells[1000, 6 + i]).Interior.Color = bgcolor1; worksheet2.get_Range(worksheet2.Cells[1, 8 + i], worksheet2.Cells[1000, 8 + i]).Interior.Color = bgcolor1; } #endregion } #endregion #region 将零售商信息写入表格内 int sellinrow = 2, selloutrow = 2; foreach (CM_Client client in clientlists) { worksheet1.Cells[sellinrow, 1] = client.ID; worksheet1.Cells[sellinrow, 2] = client.Code; worksheet1.Cells[sellinrow, 3] = client.FullName; worksheet1.Cells[sellinrow, 4] = DictionaryBLL.GetDicCollections("CM_RT_Classify")[client["RTClassify"]].Name; worksheet1.Cells[sellinrow, 5] = "'" + month.Name; //worksheet1.Cells[sellinrow, 5] = day.ToString("yyyy-MM-dd"); sellinrow++; worksheet2.Cells[selloutrow, 1] = client.ID; worksheet2.Cells[selloutrow, 2] = client.Code; worksheet2.Cells[selloutrow, 3] = client.FullName; worksheet2.Cells[selloutrow, 4] = DictionaryBLL.GetDicCollections("CM_RT_Classify")[client["RTClassify"]].Name; worksheet2.Cells[selloutrow, 5] = "'" + month.Name; //worksheet2.Cells[selloutrow, 5] = day.ToString("yyyy-MM-dd"); IList <PM_Promotor> promotorlists = PM_PromotorBLL.GetModelList("ID IN (SELECT Promotor FROM dbo.PM_PromotorInRetailer WHERE Client = " + client.ID.ToString() + ") AND Dimission=1 AND ApproveFlag=1"); for (int j = 0; j < promotorlists.Count; j++) { if (j > 0) { worksheet2.Cells[selloutrow, 1] = client.ID; worksheet2.Cells[selloutrow, 2] = client.Code; worksheet2.Cells[selloutrow, 3] = client.FullName; worksheet2.Cells[selloutrow, 4] = DictionaryBLL.GetDicCollections("CM_RT_Classify")[client["RTClassify"]].Name; worksheet2.Cells[selloutrow, 5] = "'" + month.Name; //worksheet2.Cells[selloutrow, 5] = day.ToString("yyyy-MM-dd"); } worksheet2.Cells[selloutrow, 6] = promotorlists[j].ID; worksheet2.Cells[selloutrow, 7] = promotorlists[j].Name; if (j != promotorlists.Count - 1) { selloutrow++; } } selloutrow++; } #endregion #region 设置表格格式 //设置行高 worksheet1.get_Range(worksheet1.Cells[2, 1], worksheet1.Cells[sellinrow - 1, 1]).RowHeight = 16; worksheet2.get_Range(worksheet2.Cells[2, 1], worksheet2.Cells[selloutrow - 1, 1]).RowHeight = 16; //设置表格单元格格线 worksheet1.get_Range(worksheet1.Cells[1, 1], worksheet1.Cells[sellinrow - 1, 6 + productlists.Count - 1]).Borders.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black); worksheet2.get_Range(worksheet2.Cells[1, 1], worksheet2.Cells[selloutrow - 1, 8 + productlists.Count - 1]).Borders.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black); #endregion worksheet1.Activate(); ExcelApp.AlertBeforeOverwriting = false; workbook1.SaveAs(path, XlFileFormat.xlExcel8, "", "", false, false, XlSaveAsAccessMode.xlNoChange, 1, false, missing, missing, missing); } catch (System.Exception err) { string error = "Message:" + err.Message + "<br/>" + "Source:" + err.Source + "<br/>" + "StackTrace:" + err.StackTrace + "<br/>"; lb_ErrorInfo.Text = error; MessageBox.Show(this, "系统错误-1!" + err.Message); } finally { if (workbook1 != null) { workbook1.Close(false, missing, missing); } if (worksheet1 != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet1); } if (worksheet2 != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet2); } if (workbook1 != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook1); } worksheet1 = null; worksheet2 = null; workbook1 = null; if (File.Exists(path)) { Downloadfile(path, filename); } } } catch (System.Exception err) { string error = "Message:" + err.Message + "<br/>" + "Source:" + err.Source + "<br/>" + "StackTrace:" + err.StackTrace + "<br/>"; lb_ErrorInfo.Text = error; MessageBox.Show(this, "系统错误-2!" + err.Message); } finally { if (ExcelApp != null) { ExcelApp.Workbooks.Close(); ExcelApp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(ExcelApp); ExcelApp = null; } GC.Collect(); //GC.WaitForPendingFinalizers(); } #endregion }
protected void rbl_ValueFrom_SelectedIndexChanged(object sender, EventArgs e) { tbx_searchvalue.Text = ""; tbx_searchvalue.Attributes["onfocus"] = ""; cbl_SearchValue.Items.Clear(); tbx_searchvalue.Visible = false; cbl_SearchValue.Visible = false; MCSSelectControl1.Visible = false; MCSTreeControl1.Visible = false; ddl_Param.Visible = false; if (rbl_ValueFrom.SelectedValue == "M") { #region 条件选择 UD_ModelFields modelfield = new UD_ModelFieldsBLL(new Guid(ddl_Field.SelectedValue), true).Model; if (modelfield == null) { return; } switch (modelfield.RelationType) { case 1: //字典关联 cbl_SearchValue.DataTextField = "Value"; cbl_SearchValue.DataValueField = "Key"; cbl_SearchValue.DataSource = DictionaryBLL.GetDicCollections(modelfield.RelationTableName); cbl_SearchValue.DataBind(); cbl_SearchValue.Visible = true; break; case 2: //实体表关联 if (!string.IsNullOrEmpty(modelfield.SearchPageURL)) { //通过查询控件查询 MCSSelectControl1.PageUrl = modelfield.SearchPageURL; MCSSelectControl1.Visible = true; } else if (new UD_TableListBLL(modelfield.RelationTableName).Model.TreeFlag == "Y") { MCSTreeControl1.DataSource = null; if (modelfield.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); MCSTreeControl1.DataSource = staff.GetStaffOrganizeCity(); if (MCSTreeControl1.DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { MCSTreeControl1.RootValue = "0"; MCSTreeControl1.SelectValue = "0"; } else { MCSTreeControl1.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); MCSTreeControl1.SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion } else { //通过树形结构查询 MCSTreeControl1.TableName = modelfield.RelationTableName; MCSTreeControl1.RootValue = "0"; MCSTreeControl1.SelectValue = "0"; } MCSTreeControl1.DataBind(); MCSTreeControl1.Visible = true; } else { //其他关联方式的实体表 cbl_SearchValue.DataTextField = "Value"; cbl_SearchValue.DataValueField = "Key"; cbl_SearchValue.DataSource = TreeTableBLL.GetRelationTableSourceData(modelfield.RelationTableName, modelfield.RelationValueField, modelfield.RelationTextField); cbl_SearchValue.DataBind(); cbl_SearchValue.Visible = true; } break; default: //非关联字段 tbx_searchvalue.Visible = true; break; } #endregion } else { ddl_Param.Visible = true; } }
protected void ddl_Field_SelectedIndexChanged(object sender, EventArgs e) { ddl_op.Items.Clear(); ddl_op.Visible = false; ddl_TreeLevel.Visible = false; #region 操作符选择 UD_ModelFields modelfield = new UD_ModelFieldsBLL(new Guid(ddl_Field.SelectedValue), true).Model; if (modelfield == null) { btn_addsearch.Enabled = false; return; } btn_addsearch.Enabled = true; switch (modelfield.RelationType) { case 1: //字典关联 break; case 2: //实体表关联 #region 如果是管理片区或行政城市,可以选择指定的树形级别 if (modelfield.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { ddl_TreeLevel.DataSource = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel"); ddl_TreeLevel.DataBind(); ddl_TreeLevel.Items.Insert(0, new ListItem("当前级别", "0")); ddl_TreeLevel.Items.Insert(1, new ListItem("所属于", "100")); ddl_TreeLevel.Visible = true; } else if (modelfield.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity") { ddl_TreeLevel.DataSource = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel"); ddl_TreeLevel.DataBind(); ddl_TreeLevel.Items.Insert(0, new ListItem("当前级别", "0")); ddl_TreeLevel.Items.Insert(1, new ListItem("所属于", "100")); ddl_TreeLevel.Visible = true; } #endregion break; default: //非关联字段 #region 设置操作符 switch (modelfield.DataType) { case 1: //整型(int) case 2: //小数(decimal) ddl_op.Items.Add(new ListItem("等于", "=")); ddl_op.Items.Add(new ListItem("大于", ">")); ddl_op.Items.Add(new ListItem("大于等于", ">=")); ddl_op.Items.Add(new ListItem("小于", "<")); ddl_op.Items.Add(new ListItem("小于等于", "<=")); ddl_op.Items.Add(new ListItem("不等于", "<>")); break; case 3: //字符串(varchar) case 6: //字符串(nvarchar) case 8: //ntext ddl_op.Items.Add(new ListItem("等于", "=")); ddl_op.Items.Add(new ListItem("相似", "like")); break; case 4: //日期(datetime) ddl_op.Items.Add(new ListItem("等于", "=")); ddl_op.Items.Add(new ListItem("大于", ">")); ddl_op.Items.Add(new ListItem("大于等于", ">=")); ddl_op.Items.Add(new ListItem("小于", "<")); ddl_op.Items.Add(new ListItem("小于等于", "<=")); ddl_op.Visible = true; tbx_searchvalue.Attributes["onfocus"] = "setday(this)"; break; case 5: //GUID(uniqueidentifier) case 7: //bit ddl_op.Items.Add(new ListItem("等于", "=")); ddl_op.Items.Add(new ListItem("不等于", "<>")); break; } ddl_op.SelectedIndex = 0; ddl_op.Visible = true; #endregion break; } #endregion rbl_ValueFrom_SelectedIndexChanged(null, null); }
private void BindData(int ID) { ViewState["ID"] = ID; Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(ID); lbl_ID.Text = _bll.Model.ID.ToString(); tbx_Name.Text = _bll.Model.Name; if (_bll.Model.SuperID != 0) { tree_SuperID.SelectValue = _bll.Model.SuperID.ToString(); } tbx_Code.Text = _bll.Model.Code; if (_bll.Model.Manager != 0) { select_Manager.SelectValue = _bll.Model.Manager.ToString(); select_Manager.SelectText = new Org_StaffBLL(_bll.Model.Manager).Model.RealName; } else { select_Manager.SelectValue = ""; select_Manager.SelectText = ""; } if (_bll.Model.Level != 0) { lbl_LevelName.Text = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()].Name; } tbx_ManageRegion.Text = _bll.Model["ManageRegion"]; if (ID == 1) { btn_Save.Visible = false; btn_Delete.Visible = false; } else { btn_Save.Visible = true; btn_Delete.Visible = true; } bt_AddSub.Visible = true; MessageBox.ShowConfirm(btn_Delete, "数据删除将不可恢复,确定删除么?"); btn_Delete.Visible = Addr_OrganizeCityBLL.GetModelList("SuperID=" + ViewState["ID"].ToString()).Count == 0; lbl_AlertInfo.Text = ""; #region 绑定已关联的行政区县列表 if (_bll.Model.Level.ToString() == ConfigHelper.GetConfigString("OrganizeCity-CityLevel")) { tb_OfficialCityInOrganizeCity.Visible = true; cb_CheckAll.Checked = false; cbl_OfficialList.Items.Clear(); IList <Addr_OfficialCityInOrganizeCity> lists = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OrganizeCity = " + ID.ToString()); foreach (Addr_OfficialCityInOrganizeCity e in lists) { Addr_OfficialCityBLL city = new Addr_OfficialCityBLL(e.OfficialCity); string fullname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID); ListItem item = new ListItem(fullname, e.ID.ToString()); cbl_OfficialList.Items.Add(item); } bt_AddOfficialCity.OnClientClick = "PopAddOfficialCity(" + ID.ToString() + ")"; } else { tb_OfficialCityInOrganizeCity.Visible = false; } #endregion }
protected void btn_Save_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 1) { return; } Addr_OrganizeCityBLL _bll; if ((int)ViewState["ID"] == 0) { _bll = new Addr_OrganizeCityBLL(); } else { _bll = new Addr_OrganizeCityBLL((int)ViewState["ID"]); } _bll.Model.Name = tbx_Name.Text; _bll.Model.SuperID = int.Parse(tree_SuperID.SelectValue); _bll.Model.Code = tbx_Code.Text; _bll.Model.Level = new Addr_OrganizeCityBLL(_bll.Model.SuperID).Model.Level + 1; if (select_Manager.SelectValue != "") { _bll.Model.Manager = int.Parse(select_Manager.SelectValue); } if (DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()] == null) { lbl_AlertInfo.Text = "添加城市失败,等级超出范围"; return; } _bll.Model["ManageRegion"] = tbx_ManageRegion.Text; if ((int)ViewState["ID"] == 0) { if (_bll.Add() < 0) { lbl_AlertInfo.Text = "添加城市失败。"; return; } } else { if (_bll.Model.SuperID == _bll.Model.ID) { return; } int ret = _bll.Update(); switch (ret) { case -1: lbl_AlertInfo.Text = "更新城市失败,城市名称已存在"; return; case -2: lbl_AlertInfo.Text = "更新城市失败,不能将当前城市设置为上级城市"; return; case -3: lbl_AlertInfo.Text = "更新城市失败,不能将当前城市的子城市设置为上级城市"; return; } } DataCache.RemoveCache("Cache-TreeTableBLL-GetAllNode-MCS_SYS.dbo.Addr_OrganizeCity"); Response.Redirect("OrganizeCityManage.aspx?SuperID=" + _bll.Model.SuperID.ToString()); }
//绑定基本信息 private void BindTaskData() { #region 绑定当前工作项 EWF_Task_JobCCBLL JobCCBLL = new EWF_Task_JobCCBLL((int)ViewState["JobCCID"]); if (JobCCBLL.Model == null || JobCCBLL.Model.RecipientStaff != (int)Session["UserID"]) { Response.Redirect("~/SubModule/DeskTop.aspx"); return; } if (JobCCBLL.Model.ReadFlag != "Y") { JobCCBLL.SetReadFlag("Y"); } //绑定当前抄送相关信息 lb_MessageSubject.Text = JobCCBLL.Model.MessageSubject; lb_Comment.Text = JobCCBLL.Model.Comment; EWF_Task_JobBLL JobBLL = new EWF_Task_JobBLL(JobCCBLL.Model.Job); lbl_CurrentJobName.Text = new EWF_Flow_ProcessBLL(JobBLL.Model.CurrentProcess).Model.Name; #endregion #region 绑定流程信息 EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]); ViewState["Initiator"] = task.Model.Initiator; //绑定流程信息 lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName; lbl_AppName.Text = new EWF_Flow_AppBLL(task.Model.App).Model.Name; lbl_Title.Text = task.Model.Title; hyl_RelateURL.NavigateUrl = task.Model.RelateURL; lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name; lb_StartTime.Text = task.Model.StartTime.ToString(); if (task.Model.EndTime != new DateTime(1900, 1, 1)) { lb_EndTime.Text = task.Model.EndTime.ToString(); cbx_NotifyInitiator.Visible = false; bt_SaveComment.Visible = false; tbx_Comment.Visible = false; } else { lb_EndTime.Text = "未结束"; } lt_Remark.Text = task.Model.Remark; //显示申请详细信息IFrame if (!string.IsNullOrEmpty(task.Model.RelateURL)) { tr_RelateUrl.Visible = true; string url = this.ResolveClientUrl(task.Model.RelateURL); if (url.IndexOf('?') >= 0) { url += "&ViewFramework=false&Decision=Y"; } else { url += "?ViewFramework=false&Decision=Y"; } frame_relateurl.Attributes.Add("src", url); } else { tr_RelateUrl.Visible = false; } //Bind the dataobject info NameValueCollection dataobjects = task.GetDataObjectValue(); pl_dataobjectinfo.BindData(dataobjects); pl_dataobjectinfo.SetPanelEnable(false); TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null; if (tbx_ReMark != null) { tbx_ReMark.Enabled = true; tbx_ReMark.ReadOnly = true; } //绑定审批历史 this.gv_List_DecisionHistory.DataSource = task.GetDecisionHistory(); this.gv_List_DecisionHistory.DataBind(); //绑定附件 gv_List_Attachment.BindGrid <EWF_Task_Attachment>(task.GetAttachmentsList()); #endregion }
private void FillModel(AC_CashFlowList m) { if (m == null) { return; } ID = m.ID; TradeClient = m.TradeClient; PayDate = m.PayDate; AgentStaff = m.AgentStaff; PayMode = m.PayMode; PayClassify = m.PayClassify; Amount = m.Amount; RelateDeliveryId = m.RelateDeliveryId; ConfirmState = m.ConfirmState; RelateOrderId = m.RelateOrderId; WorkList = m.WorkList; Remark = m.Remark; if (m.TradeClient > 0) { CM_Client c = new CM_ClientBLL(m.TradeClient).Model; if (c != null) { TradeClientName = c.FullName; } } if (m.AgentStaff > 0) { Org_Staff s = new Org_StaffBLL(m.AgentStaff).Model; if (s != null) { AgentStaffName = s.RealName; } } if (m.RelateDeliveryId > 0) { PBM_Delivery d = new PBM_DeliveryBLL(m.RelateDeliveryId).Model; RelateDeliveryCode = d.SheetCode == "" ? d.ID.ToString() : d.SheetCode; } if (m.RelateDeliveryId > 0) { PBM_Delivery d = new PBM_DeliveryBLL(m.RelateDeliveryId).Model; RelateDeliveryCode = d.SheetCode == "" ? d.ID.ToString() : d.SheetCode; } if (m.PayMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_PayMode")[m.PayMode.ToString()]; if (dic != null) { PayModeName = dic.Name; } } if (m.PayClassify > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_PayClassify")[m.PayClassify.ToString()]; if (dic != null) { PayClassifyName = dic.Name; } } if (m.ConfirmState > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_BillConfirmState")[m.ConfirmState.ToString()]; if (dic != null) { ConfirmStateName = dic.Name; } } }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { if (DataSet == Guid.Empty) { return; } IList <Rpt_DataSetParams> paramfields = new Rpt_DataSetBLL(DataSet, true).GetParams(); if (paramfields.Count == 0) { return; //无参数 } HtmlTable T_Content = new HtmlTable(); string[] tablestyles = new string[] { "tabForm", "dataLabel", "dataField" }; T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); HtmlTableRow tr_panel = new HtmlTableRow();//Create one TableRow for a panel tr_panel.ID = "DataSetParamPanel"; HtmlTableCell tc_panel = new HtmlTableCell(); #region The title of the panel HtmlTable tb_panel_title = new HtmlTable(); tb_panel_title.CellPadding = 0; tb_panel_title.CellSpacing = 0; tb_panel_title.Width = "100%"; tb_panel_title.Height = "28px"; tb_panel_title.Border = 0; tb_panel_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_panel_title = new HtmlTableRow(); HtmlTableCell tc_panel_title = new HtmlTableCell(); tc_panel_title.InnerHtml = "<h3>请设置统计报表参数信息</h3>"; tr_panel_title.Cells.Add(tc_panel_title); tb_panel_title.Rows.Add(tr_panel_title); tc_panel.Controls.Add(tb_panel_title); #endregion #region The content of the panel int FieldCount = 3; HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = tablestyles[0]; int i = 0; foreach (Rpt_DataSetParams param in paramfields) { string ControlID = "Param_" + param.ParamName.Replace("@", ""); //判断该控件是否已存在 if (ParamControlsInfo.ContainsKey(ControlID)) { continue; } ParamControlsInfo.Add(ControlID, param); if (param.Visible == "Y") { #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = tablestyles[1]; tc_displayname.InnerText = param.DisplayName; if (tc_displayname.InnerText.Length <= 6) { tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; } else { tc_displayname.Attributes["Style"] = "width: 100px; height: 18px;"; } tc_displayname.Attributes["nowrap"] = "nowrap"; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = tablestyles[2]; i++; WebControl control = null; int RelationType = param.RelationType; string RelationTableName = param.RelationTableName; string RelationValueField = param.RelationValueField; string RelationTextField = param.RelationTextField; #region 根据控件类型生成相应的控件 switch (param.ControlType) { case 1: //Label control = new Label(); ((Label)control).Text = GetDefaule(param.DefaultValue); break; case 2: //TextBox control = new TextBox(); if (param.DataType == 4) { control.Attributes["onfocus"] = "WdatePicker();"; } ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 3: //DropDownList control = new DropDownList(); if (RelationType == 1) //Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); if (param.DataType != 5) { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); } else { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); } if (param.DefaultValue != "") { if (((DropDownList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) { ((DropDownList)control).SelectedValue = GetDefaule(param.DefaultValue); } } break; case 4: //RadioButtonList control = new RadioButtonList(); if (RelationType == 1) //Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) { ((RadioButtonList)control).SelectedIndex = 0; } if (param.DefaultValue != "") { if (((RadioButtonList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) { ((RadioButtonList)control).SelectedValue = GetDefaule(param.DefaultValue); } } break; case 5: //MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 6: //TextBox supports search control = new MCSSelectControl(); control.ID = ControlID; if (param.SearchPageURL != "") { ((MCSSelectControl)control).PageUrl = param.SearchPageURL; } if (param.DefaultValue != "") { control.Init += new EventHandler(control_Init); } break; case 7: //MCSTreeControl control = new MCSTreeControl(); control.ID = ControlID; if (param.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } } #endregion } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } if (param.DefaultValue != "") { if (((MCSTreeControl)control).SelectValue == "0" || ((MCSTreeControl)control).SelectValue == "") { ((MCSTreeControl)control).SelectValue = GetDefaule(param.DefaultValue); } } break; } #endregion control.ID = ControlID; control.Enabled = param["Enable"] != "N"; int controlwidth = 0; if (int.TryParse(param["ControlWidth"], out controlwidth)) { control.Width = new Unit(controlwidth); } tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (param["IsRequireField"] == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = " *"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } if (param.ControlType == 2 || param.ControlType == 5) { if (param["IsRequireField"] == "Y") { RequiredFieldValidator _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(_requiredfieldvalidator); } if (param.DataType == 1 || param.DataType == 2 || param.DataType == 4) //非varchar 字符串 { CompareValidator _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; if (param.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (param.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (param.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } else { if (param.RegularExpression != "") { RegularExpressionValidator _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = param.RegularExpression; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } } } #endregion tr_panel_detail.Cells.Add(tc_control); #endregion } } #endregion tc_panel.Controls.Add(tb_panel_content); tr_panel.Cells.Add(tc_panel); T_Content.Rows.Add(tr_panel); }