Exemple #1
0
 private void DataCheck(DataRow row, FineUIPro.Form form, ref string msg)
 {
     foreach (FineUIPro.FormRow fr in form.Rows)
     {
         if (fr.Hidden)
         {
             continue;
         }
         foreach (Field cl in fr.Items)
         {
             if (cl is FineUIPro.TextBox)
             {
                 FineUIPro.TextBox tbx = (FineUIPro.TextBox)cl;
                 if (tbx.Text != row[tbx.ID.Substring(3)].ToString())
                 {
                     msg += string.Format("字段【{0}】由【{1}】变更为【{2}】;", tbx.Text + "_" + tbx.ID.Substring(3), row[tbx.ID.Substring(3)].ToString(), tbx.Text);
                 }
             }
             else if (cl is FineUIPro.DropDownList)
             {
                 FineUIPro.DropDownList ddl = (FineUIPro.DropDownList)cl;
                 if (ddl.SelectedValue != row[ddl.ID.Substring(3)].ToString())
                 {
                     msg += string.Format("字段【{0}】由【{1}】变更为【{2}】;", ddl.Text + "_" + ddl.ID.Substring(3), row[ddl.ID.Substring(3)].ToString(), ddl.SelectedValue);
                 }
             }
             else if (cl is FineUIPro.NumberBox)
             {
                 FineUIPro.NumberBox nbb = (FineUIPro.NumberBox)cl;
                 if (nbb.Text != row[nbb.ID.Substring(3)].ToString())
                 {
                     msg += string.Format("字段【{0}】由【{1}】变更为【{2}】;", nbb.Text + "_" + nbb.ID.Substring(3), row[nbb.ID.Substring(3)].ToString(), nbb.Text);
                 }
             }
             else if (cl is FineUIPro.DatePicker)
             {
                 FineUIPro.DatePicker dpk = (FineUIPro.DatePicker)cl;
                 if (dpk.Text != row[dpk.ID.Substring(3)].ToString())
                 {
                     msg += string.Format("字段【{0}】由【{1}】变更为【{2}】;", dpk.Text + "_" + dpk.ID.Substring(3), row[dpk.ID.Substring(3)].ToString(), dpk.Text);
                 }
             }
             else if (cl is FineUIPro.CheckBox)
             {
                 FineUIPro.CheckBox ckb = (FineUIPro.CheckBox)cl;
                 //row[ckb.ID.Substring(3)].ToString()
                 string strValue = ckb.Checked ? "Y" : "N";
                 if (row[ckb.ID.Substring(3)].ToString() != strValue)
                 {
                     msg += string.Format("字段【{0}】由【{1}】变更为【{2}】;", ckb.Text + "_" + ckb.ID.Substring(3), row[ckb.ID.Substring(3)].ToString(), strValue);
                 }
             }
         }
     }
 }
Exemple #2
0
 private void formGet(Form formItms, DataRow row)
 {
     foreach (Control control in formItms.Controls)
     {
         foreach (Control item in control.Controls)
         {
             if (item is FineUIPro.TextBox)
             {
                 FineUIPro.TextBox txt = (FineUIPro.TextBox)item;
                 try
                 {
                     txt.Text = row[txt.ID.Substring(3)].ToString();
                 }
                 catch { }
             }
             else if (item is FineUIPro.DropDownList)
             {
                 FineUIPro.DropDownList ddl = (FineUIPro.DropDownList)item;
                 if (ddl.ID.Substring(3) == "TYPE")
                 {
                     ddl.SelectedValue = ddlType.SelectedValue;
                 }
                 else
                 {
                     try
                     {
                         ddl.SelectedValue = row[ddl.ID.Substring(3)].ToString();
                     }
                     catch { }
                 }
             }
             else if (item is FineUIPro.CheckBox)
             {
                 FineUIPro.CheckBox cbx = (FineUIPro.CheckBox)item; try
                 {
                     if (row[cbx.ID.Substring(3)].ToString() == "Y")
                     {
                         cbx.Checked = true;
                     }
                     else
                     {
                         cbx.Checked = false;
                     }
                 }
                 catch { }
             }
             else if (item is FineUIPro.NumberBox)
             {
                 FineUIPro.NumberBox num = (FineUIPro.NumberBox)item;
                 try
                 {
                     num.Text = row[num.ID.Substring(3)].ToString();
                 }
                 catch { }
             }
             else if (item is FineUIPro.DatePicker)
             {
                 FineUIPro.DatePicker date = (FineUIPro.DatePicker)item;
                 try
                 {
                     date.Text = row[date.ID.Substring(3)].ToString();
                 }
                 catch { }
             }
         }
     }
 }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string k = GetQueryValue("k");
                foreach (Control ctrl in SimpleForm1.Controls)
                {
                    if (ctrl.GetType().Name == "FormRow")
                    {
                        foreach (Control subctrl in ctrl.Controls)
                        {
                            //Alert.Show(subctrl.GetType().Name);
                            if (subctrl.GetType().Name == "TextBox")
                            {
                                FineUIPro.TextBox tb = (FineUIPro.TextBox)subctrl;
                                if (tb.ID != "txtQuantity" && tb.ID != "txtUsingQuantity")
                                {
                                    tb.Readonly = true;
                                }
                            }
                            else if (subctrl.GetType().Name == "NumberBox")
                            {
                                NumberBox numbox = (NumberBox)subctrl;
                                if (numbox.ID != "txtQuantity")
                                {
                                    numbox.Readonly = true;
                                }
                            }
                            else if (subctrl.GetType().Name == "TextArea")
                            {
                                FineUIPro.TextArea tb = (FineUIPro.TextArea)subctrl;
                                tb.Readonly = true;
                            }
                        }
                    }
                }

                using (var appdb = new AppContext())
                {
                    int       sn   = GetQueryIntValue("id");
                    int       fsn  = GetQueryIntValue("fsn");
                    BomHeader item = appdb.bombase
                                     .Where(u => u.SN == fsn).FirstOrDefault();
                    txtOrderNo.Text = item.OrderNo;
                    txtProNo.Text   = item.ProNo;
                    txtProName.Text = item.ProName;
                    //txtClinetNo.Text = item.ClientNo;
                    txtQuantity.Text = "";
                    BomDetail current = appdb.bomdtl
                                        .Where(u => u.SN == sn).FirstOrDefault();
                    if (current == null)
                    {
                        // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                        Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                        return;
                    }
                    txtItemNo.Text        = current.ItemNo;
                    txtItemName.Text      = current.ItemName;
                    txtMaterial.Text      = current.Material;
                    txtSclass.Text        = current.Sclass;
                    txtSpec.Text          = current.Spec;
                    txtSurfaceDeal.Text   = current.SurfaceDeal;
                    txtUsingQuantity.Text = current.OrderUsingQuantity.ToString();
                    txtMakeThod.Text      = current.MainFrom;
                    //Instruction ins = appdb.instruction
                    //    .Where(u => u.OrderNo == item.OrderNo && u.ProNo == item.ProNo && u.ItemNo == current.ItemNo).FirstOrDefault() ;
                    //var instructionsql = from a in appdb.instruction
                    //                     where a.OrderNo == item.OrderNo && a.ProNo == item.ProNo && a.ItemNo == current.ItemNo
                    //                     group a by new
                    //                     {
                    //                         a.ItemNo
                    //                     } into g
                    //                     select new
                    //                     {
                    //                         g.Key.ItemNo,
                    //                         confirmquantity = (double)g.Sum(p => p.ConfirmQuantity)
                    //                     };

                    //double? cfq=  appdb.instruction.SqlQuery("select itemno,sum(ConfirmQuantity) from instruction where orderno='"+item.OrderNo+"' and prono='"+item.ProNo+"' and itemno='"+current.ItemNo+"' group by itemno",new object[]{}).FirstOrDefault().ConfirmQuantity;
                    SQLHelper.DbHelperSQL.SetConnectionString("");
                    string sql = "select sum(ConfirmQuantity) from instruction where orderno='" + item.OrderNo + "' and prono='" + item.ProNo + "' and itemno='" + current.ItemNo + "'";

                    object sq = SQLHelper.DbHelperSQL.GetSingle(sql);
                    if (sq != null)
                    {
                        txtUsingQuantity.Text = (current.OrderUsingQuantity - (double.Parse(sq.ToString()))).ToString();
                    }
                    else
                    {
                        txtUsingQuantity.Text = current.OrderUsingQuantity.ToString();
                    }
                    //if(instructionsql!=null)
                    //{
                    //    var ss = instructionsql.FirstOrDefault();
                    //    if (ss != null)
                    //    {
                    //        txtUsingQuantity.Text = (current.UsingQuantity - ss.confirmquantity).ToString();
                    //    }
                    //}
                }
                LoadData();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string k = GetQueryValue("k");
         log.Info("p:::::" + GetQueryValue("p"));
         if (k == "1")
         {
             btnSave.Hidden      = true;
             btnSaveClose.Hidden = true;
             foreach (Control ctrl in SimpleForm1.Controls)
             {
                 if (ctrl.GetType().Name == "FormRow")
                 {
                     foreach (Control subctrl in ctrl.Controls)
                     {
                         //Alert.Show(subctrl.GetType().Name);
                         if (subctrl.GetType().Name == "TextBox")
                         {
                             FineUIPro.TextBox tb = (FineUIPro.TextBox)subctrl;
                             tb.Readonly = true;
                         }
                         else if (subctrl.GetType().Name == "NumberBox")
                         {
                             NumberBox numbox = (NumberBox)subctrl;
                             numbox.Readonly = true;
                         }
                         else if (subctrl.GetType().Name == "TextArea")
                         {
                             FineUIPro.TextArea tb = (FineUIPro.TextArea)subctrl;
                             tb.Readonly = true;
                         }
                     }
                 }
             }
         }
         else
         {
         }
         txtID.Text = GetQueryValue("id");
         using (var appdb = new AppContext())
         {
             int         sn      = int.Parse(txtID.Text);
             OrderDetail current = appdb.orderdetail
                                   .Where(u => u.SN == sn).FirstOrDefault();
             if (current == null)
             {
                 // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                 Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                 return;
             }
             txtOrderNo.Text            = current.OrderNo;
             txtItemNo.Text             = current.ItemNo;
             txtItemName.Text           = current.ItemName;
             txtClinetNo.Text           = current.ClinetNo;
             txtQuantity.Text           = current.Quantity.ToString();
             txtColor.Text              = current.Color;
             txtUnit.Text               = current.Unit;
             rbtIsChange.SelectedValue  = current.IsChange.Trim();
             rbtIsNew.SelectedValue     = current.IsNew.Trim();
             rbtIspacking.SelectedValue = current.IsPackingmaterials.Trim();
             txtConutryVer.Text         = current.CountryPackVer;
             txtInputer.Text            = current.Inputer;
             tbxDemand1.Text            = current.Demand1;
             tbxDemand10.Text           = current.Demand10;
             tbxDemand11.Text           = current.Demand11;
             tbxDemand12.Text           = current.Demand12;
             tbxDemand2.Text            = current.Demand2;
             tbxDemand3.Text            = current.Demand3;
             tbxDemand4.Text            = current.Demand4;
             tbxDemand5.Text            = current.Demand5;
             tbxDemand6.Text            = current.Demand6;
             tbxDemand7.Text            = current.Demand7;
             tbxDemand8.Text            = current.Demand8;
             tbxDemand9.Text            = current.Demand9;
             tbxRemark.Text             = current.Remark;
         }
         LoadData();
     }
 }
Exemple #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormProducer).Length > 1)
            {
                return; //存在为空的非空列则返回!
            }
            foreach (FineUIPro.FormRow fr in FormProducer.Rows)
            {
                if (fr.Hidden)
                {
                    continue;
                }
                foreach (Field cl in fr.Items)
                {
                    if (cl is FineUIPro.TextBox)
                    {
                        FineUIPro.TextBox tbx = (FineUIPro.TextBox)cl;
                        if (tbx.Text.Length > (tbx.MaxLength ?? 20))
                        {
                            Alert.Show(string.Format("您输入的{0}字段长度超长,最大长度为:{1}!", tbx.Label, tbx.MaxLength), "警告提示", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }
            }
            //if (tbxCODE.Text.Length > 50 || tbxLEADER.Text.Length > 20 || tbxNAME.Text.Length > 60 || tbxTEL.Text.Length > 20)
            //{
            //    Alert.Show("您输入的{0}字段超长,!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            //if (tbxFAX.Text.Length > 20 || tbxENAME.Text.Length > 60 || tbxZIP.Text.Length > 6 || tbxEMAIL.Text.Length > 60 || tbxLOGINADDR.Text.Length > 60 || tbxJYFW.Text.Length > 60)
            //{
            //    Alert.Show("您输入的字段超长!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            //if (tbxLINKFAX.Text.Length > 40 || tbxLINKMAN.Text.Length > 20 || tbxLINKTEL.Text.Length > 40 || tbxLINKEMAIL.Text.Length > 40)
            //{
            //    Alert.Show("您输入的字段超长!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            MyTable mtType = new MyTable("DOC_PRODUCER");

            mtType.ColRow = PubFunc.FormDataHT(FormProducer);
            mtType.ColRow.Add("FLAG", "Y");
            mtType.ColRow.Add("SIMID", XTBase.Utilities.PinYinUtil.GetCodstring(tbxNAME.Text.Trim()));
            if (hfdIsNew.Text == "Y")
            {
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_PRODUCER WHERE CODE = '{0}'", mtType.ColRow["CODE"])))
                {
                    Alert.Show("生产商编码【" + tbxCODE.Text + "】已存在,请重新输入生产商编码!", "警告提示", MessageBoxIcon.Warning);
                    return;
                }
                mtType.InsertExec();
            }
            else
            {
                mtType.UpdateExec("");
            }

            Alert.Show("数据保存成功!");
            dataSearch();
            PubFunc.FormDataClear(FormProducer);
        }