Ejemplo n.º 1
0
 public void Update(PreLoadCabinet cabinet)
 {
     if (cabinet == null ||cabinet.Id <=0 || cabinet.Total <=0)
     {
         return;
     }
     PreLoadCabinetDataProvider.Update(cabinet);
 }
        public JsonResult Save(PreLoadCabinet model)
        {
            var result = new PreLoadCabinetEditModel
            {
                IsSuccess = true
            };
            try
            {
                var user = AccountHelper.GetLoginUserInfo(HttpContext.User.Identity);
                model.CustomerCode = user.CustomerCode;

                PreLoadCabinetManager.Instance.Save(model);
                result.Filled = PreLoadCabinetManager.Instance.GetFilled(user.CustomerCode, model.TGuid, model.ContainerType);
                PreLoadCabinetManager.Instance.UpdateBfb(model.TGuid, result.Filled);

            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message = ex.ToString();
            }
            return this.Json(result);
        }
        public static void Update(PreLoadCabinet cabinet)
        {
            string sql = @"UPDATE [dbo].[t_sale_yzk]
                       SET [sumS] = "+cabinet.Total+@"
                          ,[s1] = "+cabinet.Size1+@"
                          ,[s2] = " + cabinet.Size2 + @"
                            ,[s3] = " + cabinet.Size3 + @"
                            ,[s4] = " + cabinet.Size4 + @"
                            ,[s5] = " + cabinet.Size5 + @"
                            ,[s6] = " + cabinet.Size6 + @"
                            ,[s7] = " + cabinet.Size7 + @"
                            ,[s8] = " + cabinet.Size8 + @"
                            ,[s9] = " + cabinet.Size9 + @"
                            ,[s10] = " + cabinet.Size10 + @"
                            ,[s11] = " + cabinet.Size11 + @"
                            ,[s12] = " + cabinet.Size12 + @"
                            ,[s13] = " + cabinet.Size13 + @"
                            ,[s14] = " + cabinet.Size14 + @"
                            ,[s15] = " + cabinet.Size15 + @"
                            ,[s16] = " + cabinet.Size16 + @"
                            ,[s17] = " + cabinet.Size17 + @"
                            ,[s18] = " + cabinet.Size18 + @"
                            ,[s19] = " + cabinet.Size19 + @"
                            ,[s20] = " + cabinet.Size20 + @"
                     WHERE  id = " + cabinet.Id;

            SqlHelper.ExecuteNonQuery(ConnectionHelper.ConnectionString, CommandType.Text, sql);
        }
        public static void Save(PreLoadCabinet info)
        {
            #region Populate Parameters

            SqlParameter[] parameters = new SqlParameter[28];

            parameters[0] = new SqlParameter("@tGuid", SqlDbType.VarChar);
            parameters[0].Value = info.TGuid;

            parameters[1] = new SqlParameter("@fhrq", SqlDbType.DateTime);
            if(info.SendDate > DateTime.Now.AddYears(-10))
            {
                parameters[1].Value = info.SendDate;
            }
            else
            {
                parameters[1].Value = null;
            }

            parameters[2] = new SqlParameter("@bn", SqlDbType.VarChar);
            parameters[2].Value = info.BanderNo;

            parameters[3] = new SqlParameter("@xh", SqlDbType.VarChar);
            parameters[3].Value = info.ModelNo;

            parameters[4] = new SqlParameter("@xhb", SqlDbType.VarChar);
            parameters[4].Value = info.XHB;

            parameters[5] = new SqlParameter("@sumS", SqlDbType.Int);
            parameters[5].Value = info.Total;

            parameters[6] = new SqlParameter("@s1", SqlDbType.Int);
            parameters[6].Value = info.Size1;

            parameters[7] = new SqlParameter("@s2", SqlDbType.Int);
            parameters[7].Value = info.Size2;

            parameters[8] = new SqlParameter("@s3", SqlDbType.Int);
            parameters[8].Value = info.Size3;

            parameters[9] = new SqlParameter("@s4", SqlDbType.Int);
            parameters[9].Value = info.Size4;

            parameters[10] = new SqlParameter("@s5", SqlDbType.Int);
            parameters[10].Value = info.Size5;

            parameters[11] = new SqlParameter("@s6", SqlDbType.Int);
            parameters[11].Value = info.Size6;

            parameters[12] = new SqlParameter("@s7", SqlDbType.Int);
            parameters[12].Value = info.Size7;

            parameters[13] = new SqlParameter("@s8", SqlDbType.Int);
            parameters[13].Value = info.Size8;

            parameters[14] = new SqlParameter("@s9", SqlDbType.Int);
            parameters[14].Value = info.Size9;

            parameters[15] = new SqlParameter("@s10", SqlDbType.Int);
            parameters[15].Value = info.Size10;

            parameters[16] = new SqlParameter("@s11", SqlDbType.Int);
            parameters[16].Value = info.Size11;

            parameters[17] = new SqlParameter("@s12", SqlDbType.Int);
            parameters[17].Value = info.Size12;

            parameters[18] = new SqlParameter("@s13", SqlDbType.Int);
            parameters[18].Value = info.Size13;

            parameters[19] = new SqlParameter("@s14", SqlDbType.Int);
            parameters[19].Value = info.Size14;

            parameters[20] = new SqlParameter("@s15", SqlDbType.Int);
            parameters[20].Value = info.Size15;

            parameters[21] = new SqlParameter("@s16", SqlDbType.Int);
            parameters[21].Value = info.Size16;

            parameters[22] = new SqlParameter("@s17", SqlDbType.Int);
            parameters[22].Value = info.Size17;

            parameters[23] = new SqlParameter("@s18", SqlDbType.Int);
            parameters[23].Value = info.Size18;

            parameters[24] = new SqlParameter("@s19", SqlDbType.Int);
            parameters[24].Value = info.Size19;

            parameters[25] = new SqlParameter("@s20", SqlDbType.Int);
            parameters[25].Value = info.Size20;

            parameters[26] = new SqlParameter("@khdd", SqlDbType.VarChar);
            parameters[26].Value = info.Khdd;

            parameters[27] = new SqlParameter("@khjq", SqlDbType.DateTime);
            parameters[27].Value = info.Khjq;

            #endregion

            SqlHelper.ExecuteNonQuery(ConnectionHelper.ConnectionString
                                       , CommandType.StoredProcedure
                                       , "[dbo].[t_sale_yzk_Save]"
                                       , parameters);
        }
        public static Tuple<List<PreLoadCabinet>, List<PreLoadCabinet>> LoadAviailable(string customerCode, string mbn = "", int lx = 0)
        {
            var list = new List<PreLoadCabinet>();
            var list2 = new List<PreLoadCabinet>();
            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0] = new SqlParameter("@khh", SqlDbType.VarChar);
            parameters[0].Value = customerCode;
            parameters[1] = new SqlParameter("@lx", SqlDbType.SmallInt);
            parameters[1].Value = lx;
            parameters[2] = new SqlParameter("@mBn", SqlDbType.VarChar);
            parameters[2].Value = mbn;
            parameters[3] = new SqlParameter("@message", SqlDbType.VarChar);
            parameters[3].Size = 32;
            parameters[3].Direction = ParameterDirection.InputOutput;

            using (var reader = SqlHelper.ExecuteReader(
                ConnectionHelper.ConnectionString
                , CommandType.StoredProcedure
                , "spr_calc_yzk"
                , parameters))
            {
                while (reader.Read())
                {
                    var cabinet = new PreLoadCabinet();

                    //cabinet.ModelNo = reader.GetString(3);
                    //cabinet.XHB = reader.GetString(4);
                    //cabinet.SendDate = reader.GetDateTime(1);
                    //cabinet.BanderNo = reader.GetString(2);
                    //cabinet.XHB = reader.IsDBNull(4)?"":reader.GetString(4);
                    //cabinet.Total = reader.GetInt32(5);
                    //cabinet.Size1 = reader.GetInt32(6);
                    //cabinet.Size2 = reader.GetInt32(7);
                    //cabinet.Size3 = reader.GetInt32(8);
                    //cabinet.Size4 = reader.GetInt32(9);
                    //cabinet.Size5 = reader.GetInt32(10);
                    //cabinet.Size6 = reader.GetInt32(11);
                    //cabinet.Size7 = reader.GetInt32(12);
                    //cabinet.Size8 = reader.GetInt32(13);
                    //cabinet.Size9 = reader.GetInt32(14);
                    //cabinet.Size10 = reader.GetInt32(15);
                    //cabinet.Size11 = reader.GetInt32(16);
                    //cabinet.Size12 = reader.GetInt32(17);
                    //cabinet.Size13 = reader.GetInt32(18);
                    //cabinet.Size14 = reader.GetInt32(19);
                    //cabinet.Size15 = reader.GetInt32(20);
                    //cabinet.Size16 = reader.GetInt32(21);
                    //cabinet.Size17 = reader.GetInt32(22);
                    //cabinet.Size18 = reader.GetInt32(23);
                    //cabinet.Size19 = reader.GetInt32(24);
                    //cabinet.Size20 = reader.GetInt32(25);
                    cabinet.Id = reader.GetInt32(0);
                    cabinet.WcSta = reader.GetInt32(1);
                    if (!reader.IsDBNull(2))
                    {
                        cabinet.SendDate = reader.GetDateTime(2);
                    }

                    cabinet.BanderNo = reader.GetString(3);
                    cabinet.ModelNo = reader.GetString(4);
                    cabinet.XHB = reader.IsDBNull(5) ? "" : reader.GetString(5);

                    cabinet.Total = reader.GetInt32(8);

                    cabinet.Size1 = reader.GetInt32(9);
                    cabinet.Size2 = reader.GetInt32(10);
                    cabinet.Size3 = reader.GetInt32(11);
                    cabinet.Size4 = reader.GetInt32(12);
                    cabinet.Size5 = reader.GetInt32(13);
                    cabinet.Size6 = reader.GetInt32(14);
                    cabinet.Size7 = reader.GetInt32(15);
                    cabinet.Size8 = reader.GetInt32(16);
                    cabinet.Size9 = reader.GetInt32(17);
                    cabinet.Size10 = reader.GetInt32(18);
                    cabinet.Size11 = reader.GetInt32(19);
                    cabinet.Size12 = reader.GetInt32(20);
                    cabinet.Size13 = reader.GetInt32(21);
                    cabinet.Size14 = reader.GetInt32(22);
                    cabinet.Size15 = reader.GetInt32(23);
                    cabinet.Size16 = reader.GetInt32(24);
                    cabinet.Size17 = reader.GetInt32(25);
                    cabinet.Size18 = reader.GetInt32(26);
                    cabinet.Size19 = reader.GetInt32(27);
                    cabinet.Size20 = reader.GetInt32(28);

                    list.Add(cabinet);
                }

                if (reader.NextResult())
                {
                    while (reader.Read())
                    {
                        var cabinet1 = new PreLoadCabinet();
                        cabinet1.Id = reader.GetInt32(0);
                        cabinet1.WcSta = reader.GetInt32(1);
                        if (!reader.IsDBNull(2))
                        {
                            cabinet1.SendDate = reader.GetDateTime(2);
                        }

                        cabinet1.BanderNo = reader.GetString(3);
                        cabinet1.ModelNo = reader.GetString(4);
                        cabinet1.XHB = reader.IsDBNull(5) ? "" : reader.GetString(5);

                        cabinet1.Total = reader.GetInt32(8);

                        cabinet1.Size1 = reader.GetInt32(9);
                        cabinet1.Size2 = reader.GetInt32(10);
                        cabinet1.Size3 = reader.GetInt32(11);
                        cabinet1.Size4 = reader.GetInt32(12);
                        cabinet1.Size5 = reader.GetInt32(13);
                        cabinet1.Size6 = reader.GetInt32(14);
                        cabinet1.Size7 = reader.GetInt32(15);
                        cabinet1.Size8 = reader.GetInt32(16);
                        cabinet1.Size9 = reader.GetInt32(17);
                        cabinet1.Size10 = reader.GetInt32(18);
                        cabinet1.Size11 = reader.GetInt32(19);
                        cabinet1.Size12 = reader.GetInt32(20);
                        cabinet1.Size13 = reader.GetInt32(21);
                        cabinet1.Size14 = reader.GetInt32(22);
                        cabinet1.Size15 = reader.GetInt32(23);
                        cabinet1.Size16 = reader.GetInt32(24);
                        cabinet1.Size17 = reader.GetInt32(25);
                        cabinet1.Size18 = reader.GetInt32(26);
                        cabinet1.Size19 = reader.GetInt32(27);
                        cabinet1.Size20 = reader.GetInt32(28);

                        list2.Add(cabinet1);
                    }
                }


            }
            return new Tuple<List<PreLoadCabinet>, List<PreLoadCabinet>>(list, list2);
        }
Ejemplo n.º 6
0
 public void Save(PreLoadCabinet cabinet)
 {
      PreLoadCabinetDataProvider.Save(cabinet);
 }