Exemplo n.º 1
0
    public string GetNumByScodeAndOrcode(string scode)
    {
        OutStockModel modelByWhere = this.outStockBll.GetModelByWhere(string.Concat(new string[]
        {
            " where orcode='",
            this.txtPPCode.Text,
            "' and scode='",
            scode,
            "'"
        }));

        if (modelByWhere != null)
        {
            return(modelByWhere.number.ToString());
        }
        return(string.Concat(0));
    }
Exemplo n.º 2
0
        public OutStockModel GetModel(string orsid)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select orsid,orcode,scode,sprice,number,corp from Sm_out_Stock ");
            builder.Append(" where orsid=@orsid ");
            OutStockModel model = null;

            using (IDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, builder.ToString(), new SqlParameter[] { new SqlParameter("@orsid", orsid) }))
            {
                if (reader.Read())
                {
                    model = this.ReaderBind(reader);
                }
            }
            return(model);
        }
Exemplo n.º 3
0
        private void smOutReserve(SqlTransaction trans)
        {
            OutReserveModel model = new OutReserveModel {
                annx      = "",
                explain   = "",
                flowstate = 1,
                intime    = DateTime.Now,
                isout     = true,
                orcode    = DateTime.Now.ToString("yyyyMMddHHmmss"),
                orid      = Guid.NewGuid().ToString()
            };

            this.ReceiveNoteModel.soId = model.orid;
            model.person        = this.UserName;
            model.procode       = this.SendNoteMdoleInfo.prjCode.ToString();
            model.tcode         = this.TreasuryCode;
            model.PickingSector = this.getUserDepartmentName(this.sendNoteMdoleInfo.snAddUser);
            model.PickingPeople = this.UserName;
            model.IsOutTime     = DateTime.Now;
            if (this.outReserveBll.Add(trans, model) != 0)
            {
                this.outStockBll.DeleteByWhere(trans, " where orcode='" + model.orcode + "'");
                DataTable table = (DataTable)this.ViewState["DataTable"];
                if (table != null)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        OutStockModel model2 = new OutStockModel {
                            corp   = row["suppyCode"].ToString(),
                            number = Convert.ToDecimal(row["number"].ToString()),
                            orcode = model.orcode,
                            orsid  = Guid.NewGuid().ToString(),
                            scode  = row["scode"].ToString(),
                            sprice = Convert.ToDecimal(row["price"]),
                            TaskId = string.Empty
                        };
                        this.outStockBll.Add(trans, model2);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public OutStockModel ReaderBind(IDataReader dataReader)
        {
            OutStockModel model = new OutStockModel {
                orsid  = dataReader["orsid"].ToString(),
                orcode = dataReader["orcode"].ToString(),
                scode  = dataReader["scode"].ToString()
            };
            object obj2 = dataReader["sprice"];

            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                model.sprice = (decimal)obj2;
            }
            obj2 = dataReader["number"];
            if ((obj2 != null) && (obj2 != DBNull.Value))
            {
                model.number = (decimal)obj2;
            }
            model.corp = dataReader["corp"].ToString();
            return(model);
        }
Exemplo n.º 5
0
        public int Add(SqlTransaction trans, OutStockModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Sm_out_Stock(");
            builder.Append("orsid,orcode,scode,sprice,number,corp,TaskId)");
            builder.Append(" values (");
            builder.Append("@orsid,@orcode,@scode,@sprice,@number,@corp,@TaskId)");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@orsid", SqlDbType.NVarChar, 50), new SqlParameter("@orcode", SqlDbType.NVarChar, 0x40), new SqlParameter("@scode", SqlDbType.VarChar, 50), new SqlParameter("@sprice", SqlDbType.Decimal, 0x12), new SqlParameter("@number", SqlDbType.Decimal, 0x12), new SqlParameter("@corp", SqlDbType.NVarChar, 0x40), new SqlParameter("@TaskId", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value = model.orsid;
            commandParameters[1].Value = model.orcode;
            commandParameters[2].Value = model.scode;
            commandParameters[3].Value = model.sprice;
            commandParameters[4].Value = model.number;
            commandParameters[5].Value = model.corp;
            commandParameters[6].Value = model.TaskId;
            if (trans == null)
            {
                return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
            }
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }
Exemplo n.º 6
0
        public int Update(SqlTransaction trans, OutStockModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Sm_out_Stock set ");
            builder.Append("orcode=@orcode,");
            builder.Append("scode=@scode,");
            builder.Append("sprice=@sprice,");
            builder.Append("number=@number,");
            builder.Append("corp=@corp");
            builder.Append(" where orsid=@orsid ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@orsid", SqlDbType.NVarChar, 50), new SqlParameter("@orcode", SqlDbType.NVarChar, 0x40), new SqlParameter("@scode", SqlDbType.VarChar, 50), new SqlParameter("@sprice", SqlDbType.Decimal, 9), new SqlParameter("@number", SqlDbType.Decimal, 9), new SqlParameter("@corp", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value = model.orsid;
            commandParameters[1].Value = model.orcode;
            commandParameters[2].Value = model.scode;
            commandParameters[3].Value = model.sprice;
            commandParameters[4].Value = model.number;
            commandParameters[5].Value = model.corp;
            if (trans == null)
            {
                return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
            }
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }
Exemplo n.º 7
0
 public int Update(SqlTransaction trans, OutStockModel model)
 {
     return(this.outStock.Update(trans, model));
 }
Exemplo n.º 8
0
 public int Add(SqlTransaction trans, OutStockModel model)
 {
     return(this.outStock.Add(trans, model));
 }