예제 #1
0
        /// <summary>
        /// 应用套餐
        /// </summary>
        /// <param name="serviceType"></param>
        private void ApplyCombo(string serviceType)
        {
            DataTable         dt_cb02     = new DataTable();
            OracleDataAdapter cb02Adapter = new OracleDataAdapter("select * from cb02 where cb001=(select cb001 from cb01 where cb002 = '0' and cb005 = :service)", SqlHelper.conn);

            OracleParameter op_service = new OracleParameter("service", OracleDbType.Varchar2, 3);

            op_service.Direction = ParameterDirection.Input;
            cb02Adapter.SelectCommand.Parameters.Add(op_service);
            op_service.Value = serviceType;
            cb02Adapter.Fill(dt_cb02);

            /////循环处理套餐明细
            foreach (DataRow dr in dt_cb02.Rows)
            {               ///如果套餐明细项目不存在!
                if (!FireAction.ItemIsExisted(ac01.AC001, dr["CB022"].ToString(), dr["CB021"].ToString()))
                {
                    SA01 sa01 = new SA01(unitOfWork1);
                    sa01.SA001  = MiscAction.GetEntityPK("SA01");
                    sa01.AC001  = ac01.AC001;
                    sa01.SA002  = dr["CB022"].ToString();                      //类型
                    sa01.SA003  = FireAction.GetItemName(dr["CB021"].ToString());
                    sa01.SA004  = dr["CB021"].ToString();
                    sa01.SA005  = "0";
                    sa01.PRICE  = FireAction.GetItemPrice(dr["CB021"].ToString());
                    sa01.NUMS   = Convert.ToInt32(dr["CB030"]);
                    sa01.SA007  = sa01.PRICE * sa01.NUMS;
                    sa01.SA006  = sa01.PRICE;
                    sa01.SA008  = "0";
                    sa01.SA100  = Envior.cur_user.UC001;
                    sa01.SA200  = MiscAction.GetServerTime();
                    sa01.STATUS = "1";
                }
            }
        }
예제 #2
0
파일: Frm_MiscItem.cs 프로젝트: radtek/Lime
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!gridView1.PostEditor())
            {
                return;
            }
            if (!gridView1.UpdateCurrentRow())
            {
                return;
            }
            if (!gridView4.PostEditor())
            {
                return;
            }
            if (!gridView4.UpdateCurrentRow())
            {
                return;
            }

            int[] service_sel = gridView1.GetSelectedRows();
            int[] gl_sel      = gridView2.GetSelectedRows();
            int[] zl_sel      = gridView3.GetSelectedRows();
            int[] jp_sel      = gridView4.GetSelectedRows();
            if (service_sel.Length + gl_sel.Length + zl_sel.Length + jp_sel.Length <= 0)
            {
                XtraMessageBox.Show("请先选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            //延申服务处理
            foreach (int i in service_sel)
            {
                if (FireAction.ItemIsExisted(s_ac001, "05", gridView1.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.AC001  = s_ac001;
                sa01.SA002  = "05";                 //殡仪服务
                sa01.SA003  = gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView1.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView1.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
            }

            //谷类处理
            foreach (int i in gl_sel)
            {
                if (FireAction.ItemIsExisted(s_ac001, "10", gridView2.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.AC001  = s_ac001;
                sa01.SA002  = "10";                 //谷类
                sa01.SA003  = gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView2.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView2.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
            }

            //纸类处理
            foreach (int i in zl_sel)
            {
                if (FireAction.ItemIsExisted(s_ac001, "10", gridView3.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.AC001  = s_ac001;
                sa01.SA002  = "11";                 //纸类
                sa01.SA003  = gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView3.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(gridView3.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView3.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
            }

            //祭品处理
            foreach (int i in jp_sel)
            {
                if (FireAction.ItemIsExisted(s_ac001, "12", gridView4.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.AC001  = s_ac001;
                sa01.SA002  = "12";                 //祭品
                sa01.SA003  = gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView4.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(gridView4.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView4.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
            }

            try
            {
                unitOfWork1.CommitChanges();
                XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                LogUtils.Error(ee.Message);
                XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sb_ok_Click(object sender, EventArgs e)
        {
            bool b_done = false;

            if (FireAction.FireIsSettled(ac01.AC001))
            {
                XtraMessageBox.Show("该逝者已经办理火化并且结算,不能再办理业务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ///判断 守灵 冷藏 是否同时选择
            if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0 && !string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0)
            {
                if (XtraMessageBox.Show("确认要同时选择【守灵】和【冷藏】业务吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0)
            {
                if (FireAction.ItemIsExisted(ac01.AC001, "01", ""))
                {
                    if (XtraMessageBox.Show("【守灵】已经办理,是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
            }
            if (!string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0)
            {
                if (FireAction.ItemIsExisted(ac01.AC001, "02", ""))
                {
                    if (XtraMessageBox.Show("【冷藏】已经办理,是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            if (!string.IsNullOrEmpty(glookup_gbt.EditValue.ToString()) && de_gbsj.EditValue != null)
            {
                if (FireAction.ItemIsExisted(ac01.AC001, "04", ""))
                {
                    XtraMessageBox.Show("【告别】已经办理!", "确认", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            if (!string.IsNullOrEmpty(glookup_lc.EditValue.ToString()))
            {
                if (FireAction.ItemIsExisted(ac01.AC001, "07", ""))
                {
                    XtraMessageBox.Show("【灵车】已经办理!", "确认", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            ////////////////////////  业务办理 ///////////////////////
            /// 01 如果守灵厅
            if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0)
            {
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001 = MiscAction.GetEntityPK("SA01");
                sa01.AC001 = ac01.AC001;
                sa01.SA002 = "01";                  //守灵厅
                GridView view = glookup_slt.Properties.View;
                sa01.SA003  = "守灵厅" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】";
                sa01.SA004  = glookup_slt.EditValue.ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE"));
                sa01.NUMS   = Convert.ToDecimal(te_slt_nums.Text);
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("01");
                b_done = true;
                //sa01.Save();
            }
            /// 02 如果冷藏柜
            if (!string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0)
            {
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001 = MiscAction.GetEntityPK("SA01");
                sa01.AC001 = ac01.AC001;
                sa01.SA002 = "02";                  //冷藏柜
                GridView view = glookup_lcg.Properties.View;
                sa01.SA003  = "冷藏" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】";
                sa01.SA004  = glookup_lcg.EditValue.ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE"));
                sa01.NUMS   = Convert.ToDecimal(te_slt_nums.Text);
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("02");
                b_done = true;
                //sa01.Save();
            }
            ///03 休息室
            foreach (int i in gridView2.GetSelectedRows())
            {
                if (FireAction.ItemIsExisted(ac01.AC001, "03", gridView2.GetRowCellValue(i, "SI001").ToString()))
                {
                    throw new Exception("【" + gridView2.GetRowCellValue(i, "SI003").ToString() + "】" + "已经存在!");
                }
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.AC001  = ac01.AC001;
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.SA002  = "03";                 //休息室
                sa01.SA003  = "休息室" + "【" + gridView2.GetRowCellValue(i, "SI003") + "】";
                sa01.SA004  = gridView2.GetRowCellValue(i, "SI001").ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = 1;
                sa01.SA007  = sa01.PRICE;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("03");
                b_done = true;
                //sa01.Save();
            }

            ///04 告别厅
            if (!string.IsNullOrEmpty(glookup_gbt.EditValue.ToString()) && de_gbsj.EditValue != null)
            {
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001 = MiscAction.GetEntityPK("SA01");
                sa01.AC001 = ac01.AC001;
                sa01.SA002 = "04";                  //告别厅
                GridView view = glookup_gbt.Properties.View;
                sa01.SA003  = "告别厅" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】";
                sa01.SA004  = glookup_gbt.EditValue.ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE"));
                sa01.NUMS   = 1;
                sa01.SA007  = sa01.PRICE;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("04");
                ac01.AC018 = Convert.ToDateTime(de_gbsj.EditValue);                  //告别时间
                b_done     = true;
            }

            ///07 灵车
            if (!string.IsNullOrEmpty(glookup_lc.EditValue.ToString()))
            {
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001 = MiscAction.GetEntityPK("SA01");
                sa01.AC001 = ac01.AC001;
                sa01.SA002 = "07";                  //灵车
                GridView view = glookup_lc.Properties.View;
                sa01.SA003  = "灵车" + "【" + view.GetRowCellDisplayText(view.FocusedRowHandle, "SI003") + "】";
                sa01.SA004  = glookup_lc.EditValue.ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE"));
                sa01.NUMS   = 1;
                sa01.SA007  = sa01.PRICE;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("07");
                b_done = true;
                //sa01.Save();
            }

            ///06 火化
            if (!string.IsNullOrEmpty(glookup_hh.EditValue.ToString()) && de_hhsj.EditValue != null)
            {
                SA01 sa01 = new SA01(unitOfWork1);
                sa01.SA001 = MiscAction.GetEntityPK("SA01");
                sa01.AC001 = ac01.AC001;
                sa01.SA002 = "06";                  //火化
                GridView view = glookup_hh.Properties.View;
                sa01.SA003  = "火化" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】";
                sa01.SA004  = glookup_hh.EditValue.ToString();
                sa01.SA005  = "0";
                sa01.PRICE  = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE"));
                sa01.NUMS   = 1;
                sa01.SA007  = sa01.PRICE;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                ApplyCombo("06");

                ac01.AC015 = Convert.ToDateTime(de_hhsj.EditValue);                   //火化时间
                b_done     = true;
            }

            if (!b_done)
            {
                XtraMessageBox.Show("还未选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            try
            {
                unitOfWork1.CommitChanges();
                XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                LogUtils.Error(ee.Message);
                XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }