示例#1
0
        protected CMSMStruct.CompDeptStruct GetComDeptByCompName(string strCompName)
        {
            DataView dv = new DataView(SysInitial.dsSys.Tables["MebComp"]);

            dv.Sort = "cnvcCompanyName";
            CMSMStruct.CompDeptStruct comd1 = new CMSMStruct.CompDeptStruct();
            comd1.strCompanyID   = dv[dv.Find(strCompName)]["cnvcCompanyID"].ToString().Trim();
            comd1.strCompanyName = dv[dv.Find(strCompName)]["cnvcCompanyName"].ToString().Trim();
            comd1.strDeptID      = dv[dv.Find(strCompName)]["cnvcDeptID"].ToString().Trim();
            comd1.strDeptName    = dv[dv.Find(strCompName)]["cnvcDeptName"].ToString().Trim();
            return(comd1);
        }
示例#2
0
        private void DgBind()
        {
            string strCardID   = txtCardID.Text.Trim();
            string strCompName = cmbCompName.Text.Trim();
            string strBegin    = dtpBegin.Value.ToShortDateString() + " 00:00:00";
            string strEnd      = dtpEnd.Value.ToShortDateString() + " 23:59:59";
            string strCompID   = "";

            if (strCompName == "全部")
            {
                strCompID = "";
            }
            else
            {
                CMSMStruct.CompDeptStruct comp1 = this.GetComDeptByCompName(strCompName);
                strCompID = comp1.strCompanyID;
            }
            DataTable dt = new DataTable();

            err = null;
            dt  = cs.GetConsRepeat(strCardID, strCompID, strBegin, strEnd, out err);
            if (dt != null)
            {
                int    consCount = dt.Rows.Count;
                double consfee   = 0;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    consfee += double.Parse(dt.Rows[i]["cnnFee"].ToString());
                }
                this.txtCount.Text  = consCount.ToString();
                this.txtTolFee.Text = consfee.ToString();
                this.dataGrid1.SetDataBinding(dt, "");
                this.EnToCh("流水号,会员卡号,车牌号,油料名称,油料型号,计量单位,密度,数量,单价,金额,备注,单位名称,消费日期", "120,80,100,50,50,60,50,80,80,100,80", dt, this.dataGrid1);
            }
            else
            {
                MessageBox.Show("查询小票出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
            }
        }
示例#3
0
 private void cmbCompName_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     CMSMStruct.CompDeptStruct compdept = this.GetComDeptByCompName(this.cmbCompName.Text.Trim());
     txtDeptName.Text = compdept.strDeptName;
 }
示例#4
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MemberStruct meb1 = new CMSMStruct.MemberStruct();
            if (txtCardID.Text.Trim() == "" || txtCardID.Text.Trim().Length != 5)
            {
                MessageBox.Show("会员卡号不可为空且为5位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            else if (!cs.ChkCardIDDup(txtCardID.Text.Trim(), out err))
            {
                meb1.strCardID = txtCardID.Text.Trim();
            }
            else
            {
                if (err == null)
                {
                    MessageBox.Show("该卡已经有其他会员使用,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    txtCardID.Focus();
                    return;
                }
                else
                {
                    MessageBox.Show("检查卡号错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine(err);
                    return;
                }
            }

            if (cmbCompName.Text.Trim() == "")
            {
                MessageBox.Show("无单位信息,请先录入单位信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                meb1.strCompanyName = cmbCompName.Text.Trim();
            }

            CMSMStruct.CompDeptStruct compdept = this.GetComDeptByCompName(meb1.strCompanyName);
            meb1.strCompanyID = compdept.strCompanyID;
            meb1.strDeptID    = compdept.strDeptID;
            meb1.strDeptName  = compdept.strDeptName;
            if (meb1.strDeptName == "" || meb1.strDeptID == "")
            {
                MessageBox.Show("部门参数不正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (txtLicenseTag.Text.Trim() != "" && txtLicenseTag.Text.Trim().Length > 20)
            {
                MessageBox.Show("车牌号不可为空且小于20个字符,请重新填写车牌号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtLicenseTag.Focus();
                return;
            }
            else
            {
                meb1.strLicenseTag = txtLicenseTag.Text.Trim();
            }

            meb1.strGoodsName  = cmbGoodsName.Text.Trim();
            meb1.strGoodsType  = cmbGoodsType.Text.Trim();
            meb1.strState      = "0";
            meb1.strComments   = txtComments.Text.Trim();
            meb1.strCreateDate = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString();
            meb1.strOperName   = SysInitial.CurOps.strOperName;
            meb1.strOperDate   = meb1.strCreateDate;

            err = null;
            string strresult = cs.InsertMember(meb1, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                MessageBox.Show("添加新会员失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null && strresult != null)
                {
                    clog.WriteLine(err.Message + "\n" + strresult);
                }
                else if (err != null)
                {
                    clog.WriteLine(err);
                }
                else
                {
                    clog.WriteLine(strresult);
                }
            }
            else
            {
                MessageBox.Show("添加新会员成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.txtCardID.Text     = "";
                this.txtLicenseTag.Text = "";
                this.txtComments.Text   = "";
            }
        }