示例#1
0
        protected override void billDelRow()
        {
            if (string.IsNullOrWhiteSpace(docBILLNO.Text))
            {
                Alert.Show("空单据,无法进行【删行】操作");
                return;
            }
            if (docFLAG.SelectedValue != "M")
            {
                Alert.Show("非新单,不能进行【删行】操作!");
                return;
            }
            if (GridLis.SelectedCell == null)
            {
                return;
            }
            int rowIndex = GridLis.SelectedRowIndex;

            if (rowIndex < 0)
            {
                return;
            }

            PageContext.RegisterStartupScript(Confirm.GetShowReference("确认要对第【" + (rowIndex + 1) + "】行进行【删行】的操作吗?", "警告提示",
                                                                       MessageBoxIcon.Information, PageManager1.GetCustomEventReference("billDelRow_Ok"),
                                                                       PageManager1.GetCustomEventReference("billDelRow_Cancel"))); //,true

            //20150510 liuz
            List <Dictionary <string, object> > newDict = GridLis.GetNewAddedList();

            newDict.RemoveAt(rowIndex);
        }
示例#2
0
        protected bool DataSave(string flag = "N")
        {
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非[已提交]不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = GridLis.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();

            if (goodsData.Count < 1)
            {
                Alert.Show("请添加要生成养护单的商品信息!", "提示信息", MessageBoxIcon.Warning);
                return(false);
            }

            List <CommandInfo> cmdList = new List <CommandInfo>();

            if (PubFunc.StrIsEmpty(docSEQNO.Text))
            {
                docSEQNO.Text  = BillSeqGet();
                docBILLNO.Text = docSEQNO.Text;
            }
            else
            {
                if (docBILLNO.Text.Length > 16)
                {
                    Alert.Show("单据编号长度不能大于16,请检查!", "消息提示", MessageBoxIcon.Warning);
                    return(false);
                }
                docSEQNO.Text = docBILLNO.Text;
            }
            cmdList.Add(new CommandInfo("delete from dat_yh_doc where seqno='" + docSEQNO.Text + "'", null));
            cmdList.Add(new CommandInfo("delete from dat_yh_com where seqno='" + docSEQNO.Text + "'", null));

            MyTable mtType = new MyTable("DAT_YH_DOC");

            mtType.ColRow = PubFunc.FormDataHT(Formlis);
            mtType.ColRow.Add("BILLTYPE", BillType);
            decimal decTotal = 0;
            MyTable mtTypeMx = new MyTable("DAT_YH_COM");

            //先删除单据信息在插入
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                if (mtTypeMx.ColRow["REASON"].ToString().Length > 80)
                {
                    Alert.Show("第【" + i + 1 + "】行【原因说明】字段超出规定长度");
                    return(false);
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PH", mtTypeMx.ColRow["PHID"]);
                decTotal += decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUBSUM", decTotal);
            if (flag == "Y")
            {
                mtType.ColRow["FLAG"] = "Y";
                //mtType.ColRow["SHR"] = ddlSHR.SelectedValue;
                mtType.ColRow["SHR"]  = UserAction.UserID;
                mtType.ColRow["SHRQ"] = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            }
            cmdList.Add(mtType.Insert());
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }