Ejemplo n.º 1
0
        public String update(MaterialRec p, String userId)
        {
            String re  = "";
            String sql = "";
            int    chk = 0;

            chkNull(p);
            sql = "Update " + matr.table + " Set " +
                  " " + matr.matr_code + " = '" + p.matr_code + "'" +
                  "," + matr.matr_date + " = '" + p.matr_date.Replace("'", "''") + "'" +
                  "," + matr.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + matr.date_modi + " = now()" +
                  "," + matr.user_modi + " = '" + userId + "' " +
                  "," + matr.host_id + " = '" + p.host_id + "' " +
                  "," + matr.branch_id + " = '" + p.branch_id + "' " +
                  "," + matr.device_id + " = '" + p.device_id + "' " +
                  //"," + fooC.status_aircondition + " = '" + p.status_aircondition + "' " +

                  "Where " + matr.pkField + "='" + p.matr_id + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Ejemplo n.º 2
0
        private void initConfig()
        {
            lfooT                  = new List <MaterialRec>();
            matr                   = new MaterialRec();
            matr.matr_id           = "matr_id";
            matr.matr_code         = "matr_code";
            matr.matr_date         = "matr_date";
            matr.active            = "active";
            matr.remark            = "remark";
            matr.sort1             = "sort1";
            matr.date_cancel       = "date_cancel";
            matr.date_create       = "date_create";
            matr.date_modi         = "date_modi";
            matr.user_cancel       = "user_cancel";
            matr.user_create       = "user_create";
            matr.user_modi         = "user_modi";
            matr.host_id           = "host_id";
            matr.branch_id         = "branch_id";
            matr.device_id         = "device_id";
            matr.year_id           = "year_id";
            matr.status_stock      = "status_stock";
            matr.status_stock_year = "status_stock_year";

            matr.pkField = "matr_id";
            matr.table   = "t_material_rec";
        }
Ejemplo n.º 3
0
        private void initConfig()
        {
            fEdit  = new Font(mposC.iniC.grdViewFontName, mposC.grdViewFontSize, FontStyle.Regular);
            fEditB = new Font(mposC.iniC.grdViewFontName, mposC.grdViewFontSize, FontStyle.Bold);
            stt    = new C1SuperTooltip();
            sep    = new C1SuperErrorProvider();
            matr   = new MaterialRec();

            //C1ThemeController.ApplicationTheme = mposC.iniC.themeApplication;
            theme1.Theme = mposC.iniC.themeApplication;
            theme1.SetTheme(panel2, mposC.iniC.themeApplication);
            theme1.SetTheme(sB, "BeigeOne");
            foreach (Control c in panel2.Controls)
            {
                theme1.SetTheme(c, mposC.iniC.themeApplication);
            }
            txtMatrDate.Value            = System.DateTime.Now.Year + "-" + System.DateTime.Now.ToString("MM-dd");
            cboMethod                    = new C1ComboBox();
            cboMethod.AutoCompleteMode   = AutoCompleteMode.Suggest;
            cboMethod.AutoCompleteSource = AutoCompleteSource.ListItems;
            mposC.mposDB.matDB.setCboMaterial(cboMethod, "");
            btnVoid.Hide();
            txtPasswordVoid.Hide();

            btnSave.Click          += BtnSave_Click;
            chkVoid.CheckedChanged += ChkVoid_CheckedChanged;
            txtPasswordVoid.KeyUp  += TxtPasswordVoid_KeyUp;
            btnVoid.Click          += BtnVoid_Click;
            btnDoc.Click           += BtnDoc_Click;

            initGrfMatr();
            sB1.Text = "";
        }
Ejemplo n.º 4
0
        public String insert(MaterialRec p, String userId)
        {
            String re  = "";
            String sql = "";

            p.active = "1";
            //p.ssdata_id = "";
            int chk = 0;

            chkNull(p);
            sql = "Insert Into " + matr.table + " set " +
                  " " + matr.matr_code + " = '" + p.matr_code + "'" +
                  "," + matr.matr_date + " = '" + p.matr_date.Replace("'", "''") + "'" +
                  "," + matr.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + matr.date_create + " = now()" +
                  "," + matr.active + " = '1'" +
                  "," + matr.user_create + " = '" + userId + "' " +
                  "," + matr.host_id + " = '" + p.host_id + "' " +
                  "," + matr.branch_id + " = '" + p.branch_id + "' " +
                  "," + matr.device_id + " = '" + p.device_id + "' " +
                  "," + matr.year_id + " = year(now()) " +
                  "," + matr.status_stock + " = '" + p.status_stock + "' " +
                  "," + matr.status_stock_year + " = '" + p.status_stock_year + "' " +
                  " ";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存耗材信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BaseResponse <IList <MaterialRecord> > SaveMaterialRec(MaterialRec request)
        {
            var response = new BaseResponse <IList <MaterialRecord> >();

            foreach (var item in request.Data)
            {
                Mapper.Reset();
                Mapper.CreateMap <MaterialRecord, LTC_MATERIALRECORD>();
                Mapper.CreateMap <LTC_MATERIALRECORD, MaterialRecord>();
                var Model = unitOfWork.GetRepository <LTC_MATERIALRECORD>().dbSet.FirstOrDefault(m => m.MATERIALRECORDID == item.MaterialRecordId);
                if (Model == null)
                {
                    Model            = Mapper.Map <LTC_MATERIALRECORD>(item);
                    Model.NSID       = SecurityHelper.CurrentPrincipal.OrgId;
                    Model.ISDELETE   = false;
                    Model.OPERATOR   = SecurityHelper.CurrentPrincipal.EmpNo;
                    Model.CREATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    Model.UPDATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    Model.STATUS     = 0;
                    Model.CREATETIME = DateTime.Now;
                    Model.UPDATETIME = DateTime.Now;
                    unitOfWork.GetRepository <LTC_MATERIALRECORD>().Insert(Model);
                }
                else
                {
                    Mapper.Map(item, Model);
                    Model.UPDATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    Model.UPDATETIME = DateTime.Now;
                    unitOfWork.GetRepository <LTC_MATERIALRECORD>().Update(Model);
                }
                unitOfWork.Save();
            }
            return(response);
        }
Ejemplo n.º 6
0
        private MaterialRec setArea1(DataTable dt)
        {
            MaterialRec dept1 = new MaterialRec();

            if (dt.Rows.Count > 0)
            {
                dept1.matr_id   = dt.Rows[0][matr.matr_id].ToString();
                dept1.matr_date = dt.Rows[0][matr.matr_date].ToString();
            }

            return(dept1);
        }
Ejemplo n.º 7
0
        public MaterialRec selectByPk1(String copId)
        {
            MaterialRec cop1 = new MaterialRec();
            DataTable   dt   = new DataTable();
            String      sql  = "select sex.* " +
                               "From " + matr.table + " sex " +
                               //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " +
                               "Where sex." + matr.pkField + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setTMaterial(dt);
            return(cop1);
        }
Ejemplo n.º 8
0
        private void setControl()
        {
            matr            = mposC.mposDB.matrDB.selectByPk1(matr_id);
            txtMatrId.Value = matr.matr_id;
            if (matr.matr_date.Length > 0)
            {
                txtMatrDate.Value = mposC.datetoShow(matr.matr_date);
            }
            txtRemark.Value   = matr.remark;
            txtMatrCode.Value = matr.matr_code;

            setGrfMatr();
        }
Ejemplo n.º 9
0
        public String insertMatarialRec(MaterialRec p, String userId)
        {
            String re = "";

            if (p.matr_id.Equals(""))
            {
                re = insert(p, "");
            }
            else
            {
                re = update(p, "");
            }

            return(re);
        }
Ejemplo n.º 10
0
        public void getlArea()
        {
            //lDept = new List<Position>();
            lfooT.Clear();
            DataTable dt = new DataTable();

            dt = selectAll();
            foreach (DataRow row in dt.Rows)
            {
                MaterialRec itm1 = new MaterialRec();
                itm1.matr_id   = row[matr.matr_id].ToString();
                itm1.matr_date = row[matr.matr_date].ToString();

                lfooT.Add(itm1);
            }
        }
Ejemplo n.º 11
0
        private MaterialRec setTMaterial(DataTable dt)
        {
            MaterialRec dept1 = new MaterialRec();

            if (dt.Rows.Count > 0)
            {
                dept1.matr_id   = dt.Rows[0][matr.matr_id].ToString();
                dept1.matr_code = dt.Rows[0][matr.matr_code].ToString();
                dept1.matr_date = dt.Rows[0][matr.matr_date].ToString();
                //dept1.posi_name_e = dt.Rows[0][area.posi_name_e] != null ? dt.Rows[0][area.posi_name_e].ToString() : "";
                //dept1.status_doctor = dt.Rows[0][area.status_doctor] != null ? dt.Rows[0][area.status_doctor].ToString() : "";
                dept1.remark            = dt.Rows[0][matr.remark] != null ? dt.Rows[0][matr.remark].ToString() : "";
                dept1.date_create       = dt.Rows[0][matr.date_create] != null ? dt.Rows[0][matr.date_create].ToString() : "";
                dept1.date_modi         = dt.Rows[0][matr.date_modi] != null ? dt.Rows[0][matr.date_modi].ToString() : "";
                dept1.date_cancel       = dt.Rows[0][matr.date_cancel] != null ? dt.Rows[0][matr.date_cancel].ToString() : "";
                dept1.user_create       = dt.Rows[0][matr.user_create] != null ? dt.Rows[0][matr.user_create].ToString() : "";
                dept1.user_modi         = dt.Rows[0][matr.user_modi] != null ? dt.Rows[0][matr.user_modi].ToString() : "";
                dept1.user_cancel       = dt.Rows[0][matr.user_cancel] != null ? dt.Rows[0][matr.user_cancel].ToString() : "";
                dept1.active            = dt.Rows[0][matr.active] != null ? dt.Rows[0][matr.active].ToString() : "";
                dept1.status_stock      = dt.Rows[0][matr.status_stock] != null ? dt.Rows[0][matr.status_stock].ToString() : "";
                dept1.status_stock_year = dt.Rows[0][matr.status_stock_year] != null ? dt.Rows[0][matr.status_stock_year].ToString() : "";
            }
            else
            {
                dept1.matr_id   = "";
                dept1.matr_code = "";
                dept1.matr_date = "";
                //posi.dept_parent_id = "dept_parent_id";
                dept1.remark            = "";
                dept1.date_create       = "";
                dept1.date_modi         = "";
                dept1.date_cancel       = "";
                dept1.user_create       = "";
                dept1.user_modi         = "";
                dept1.user_cancel       = "";
                dept1.active            = "";
                dept1.sort1             = "";
                dept1.status_stock      = "";
                dept1.status_stock_year = "";
            }

            return(dept1);
        }
Ejemplo n.º 12
0
        private void chkNull(MaterialRec p)
        {
            long chk = 0;

            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;

            p.matr_date = p.matr_date == null ? "" : p.matr_date;
            p.matr_code = p.matr_code == null ? "" : p.matr_code;

            p.year_id           = p.year_id == null ? "" : p.year_id;
            p.status_stock      = p.status_stock == null ? "" : p.status_stock;
            p.status_stock_year = p.status_stock_year == null ? "" : p.status_stock_year;

            p.host_id   = long.TryParse(p.host_id, out chk) ? chk.ToString() : "0";
            p.branch_id = long.TryParse(p.branch_id, out chk) ? chk.ToString() : "0";
            p.device_id = long.TryParse(p.device_id, out chk) ? chk.ToString() : "0";
        }