Ejemplo n.º 1
0
        public BllMaterial MapToBll(DalMaterial entity)
        {
            BllMaterial bllEntity = new BllMaterial
            {
                Id          = entity.Id,
                Description = entity.Description,
                Name        = entity.Name
            };

            return(bllEntity);
        }
Ejemplo n.º 2
0
        public DalMaterial MapToDal(BllMaterial entity)
        {
            DalMaterial dalEntity = new DalMaterial
            {
                Id          = entity.Id,
                Description = entity.Description,
                Name        = entity.Name
            };

            return(dalEntity);
        }
 public Object Get(string ActionType, string chrType, long PageIndex, long PageSize)
 {
     if (ActionType == "Select")
     {
         string strWhere  = " where chrType like '%" + chrType + "%' ";
         long   RowAmount = 0;
         using (SqlConnection con = new SqlConnection(_ConString))
         {
             BllMaterial Bll = new BllMaterial(con);
             return(Bll.Get(PageIndex, PageSize, strWhere, out RowAmount));
         }
     }
     else
     {
         return(null);
     }
 }
        public Object Post([FromBody] Material.MStandard newMaterial)
        {
            ReturnData Result = new ReturnData();

            try
            {
                SqlConnection con = new SqlConnection(_ConString);
                con.Open();
                SqlTransaction tran = con.BeginTransaction();
                try
                {
                    BllMaterial Bll = new BllMaterial(con);
                    if (Bll.InsertOrUpdate(newMaterial, tran))
                    {
                        tran.Commit();
                        Result.Result = true;
                        Result.Msg    = "³É¹¦";
                    }
                    else
                    {
                        tran.Rollback();
                        Result.Result = false;
                        Result.Msg    = "ʧ°Ü";
                    }
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    Result.Result = false;
                    Result.Msg    = ex.Message;
                }
                finally
                {
                    con.Close();
                }
                return(Result);
            }
            catch (Exception ex)
            {
                Result.Result = false;
                Result.Msg    = ex.Message;
                return(Result);
            }
        }