private void AddPrice()
        {
            if (this.ViewErrList != null && this.ViewErrList.Value.Count > 0)
            {
                return;
            }

            if (string.IsNullOrEmpty(this.SKeyCode.Trim()))
            {
                return;
            }

            var model = new MSale_PriceTemplate_Lens_ProCost();

            model = new MSale_PriceTemplate_Lens_ProCost()
            {
                CB       = this.CB,
                ChB      = this.ChB,
                CS       = this.CS,
                F_Set    = this.F_Set,
                InvTitle = this.InvTitle,
                JJ       = this.JJ,
                JS       = this.JS,
                JY       = this.JY,
                KK       = this.KK,
                OP       = this.OP,
                PG       = this.PG,
                PiH      = this.PiH,
                RS       = this.RS,
                SY       = this.SY,
                UV       = this.UV,
                ZK       = this.ZK,
                ID       = "",
                LensCode = this.SKeyCode,
                P1       = this.P1,
                P2       = this.P2
            };
            DSSale_PriceTemplate_Lens_ProCost _DS = new DSSale_PriceTemplate_Lens_ProCost();

            this.IsBusy = true;
            _DS.AddProCost(USysInfo.DBCode, USysInfo.LgIndex, model, geted =>
            {
                this.IsBusy = false;
                if (geted.HasError)
                {
                    MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
                    geted.MarkErrorAsHandled();
                    return;
                }
                this.Search();
            }, null);
        }
Esempio n. 2
0
        public void AddProCost(string dbCode, int lgIndex, MSale_PriceTemplate_Lens_ProCost t)
        {
            var           model  = t;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sale_PriceTemplate_Lens_ProCost(");
            strSql.Append("ID,LensCode,F_Set,InvTitle,JY,UV,JS,RS,CS,SY,CB,ChB,KK,ZK,PiH,PG,JJ,OP,P1,P2)");
            strSql.Append(" values (");
            strSql.Append("(select HKOERP.dbo.SF_GetID()),@LensCode,@F_Set,@InvTitle,@JY,@UV,@JS,@RS,@CS,@SY,@CB,@ChB,@KK,@ZK,@PiH,@PG,@JJ,@OP,@P1,@P2)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LensCode", SqlDbType.VarChar,  30),
                new SqlParameter("@F_Set",    SqlDbType.Bit,       1),
                new SqlParameter("@InvTitle", SqlDbType.NVarChar, 40),
                new SqlParameter("@JY",       SqlDbType.Bit,       1),
                new SqlParameter("@UV",       SqlDbType.Bit,       1),
                new SqlParameter("@JS",       SqlDbType.VarChar,  15),
                new SqlParameter("@RS",       SqlDbType.VarChar,  15),
                new SqlParameter("@CS",       SqlDbType.VarChar,  15),
                new SqlParameter("@SY",       SqlDbType.VarChar,  15),
                new SqlParameter("@CB",       SqlDbType.VarChar,  15),
                new SqlParameter("@ChB",      SqlDbType.VarChar,  15),
                new SqlParameter("@KK",       SqlDbType.VarChar,  15),
                new SqlParameter("@ZK",       SqlDbType.VarChar,  15),
                new SqlParameter("@PiH",      SqlDbType.VarChar,  15),
                new SqlParameter("@PG",       SqlDbType.VarChar,  15),
                new SqlParameter("@JJ",       SqlDbType.VarChar,  15),
                new SqlParameter("@OP",       SqlDbType.VarChar,  15),
                new SqlParameter("@P1",       SqlDbType.Decimal,   9),
                new SqlParameter("@P2",       SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.LensCode;
            parameters[1].Value  = model.F_Set;
            parameters[2].Value  = model.InvTitle;
            parameters[3].Value  = model.JY;
            parameters[4].Value  = model.UV;
            parameters[5].Value  = model.JS;
            parameters[6].Value  = model.RS;
            parameters[7].Value  = model.CS;
            parameters[8].Value  = model.SY;
            parameters[9].Value  = model.CB;
            parameters[10].Value = model.ChB;
            parameters[11].Value = model.KK;
            parameters[12].Value = model.ZK;
            parameters[13].Value = model.PiH;
            parameters[14].Value = model.PG;
            parameters[15].Value = model.JJ;
            parameters[16].Value = model.OP;
            parameters[17].Value = model.P1;
            parameters[18].Value = model.P2;
            DALHelper.ExecuteSql(dbCode, strSql.ToString(), parameters);
        }