Exemplo n.º 1
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(WorkGroup model)
        {
            int count = 0;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //更新基本信息
                    count = session.Update <WorkGroup>(model);
                    string sql = "DELETE FROM T_FP_WORKGROUPREF WHERE WOID = @WOID";
                    parameters.Add(new DataParameter {
                        ParameterName = "WOID", DataType = DbType.String, Value = model.PID
                    });
                    session.ExecuteSqlScalar(sql, parameters.ToArray());
                    foreach (WorkGroupRef detail in model.Details)
                    {
                        WorkGroupRef workGroupRef = new WorkGroupRef();
                        workGroupRef.PID  = Guid.NewGuid().ToString();
                        workGroupRef.PEID = detail.PEID;
                        workGroupRef.WOID = model.PID;
                        session.Insert <WorkGroupRef>(workGroupRef);
                    }
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int InsertRef(WorkGroupRef model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //插入基本信息
                    count = session.Insert <WorkGroupRef>(model);
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public DataResult <int> InsertRef(WorkGroupRef model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                //基本信息
                model.PID = Guid.NewGuid().ToString();
                WorkGroupDAL cmdDAL = new WorkGroupDAL();
                result.Result    = new WorkGroupDAL().InsertRef(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            WorkGroupRef info = new WorkGroupRef();
            WorkGroupBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <WorkGroupBLL>();

                bll.InsertRef(info);

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }