コード例 #1
0
ファイル: index.aspx.cs プロジェクト: ayushman2013/SaMI.WebV2
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UserTypes objUserTypes = new UserTypes();
            objUserTypes.UserTypeDesc = txtUserTypeDesc.Text;
            objUserTypes.UserTypeCode = txtUserTypeCode.Text;

            if (!string.IsNullOrEmpty(hfUserTypeID.Value.ToString()))
            {
                objUserTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objUserTypes.UpdatedDate = DateTime.Now;
                objUserTypes.UserTypeID = Convert.ToInt32(hfUserTypeID.Value);
                objUserTypes.UserTypeDesc = txtUserTypeDesc.Text;
                objUserTypes.UserTypeCode = txtUserTypeCode.Text;
                UserTypeBO.UpdateUserTypes(objUserTypes);
            }
            else
            {
                objUserTypes.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objUserTypes.CreatedDate = DateTime.Now;
                UserTypeBO.InsertUserTypes(objUserTypes);
            }


            txtUserTypeDesc.Text = string.Empty;
            txtUserTypeCode.Text = string.Empty;
            hfUserTypeID.Value = string.Empty;
            
            loadUserType();
        }
コード例 #2
0
 // GET api/usertype
 public List<UserTypes> Get()
 {
     List<UserTypes> listUserTypes = new List<UserTypes>();
     DataView dvUserType = UserTypeBO.GetAllForSync();
     foreach (DataRowView drvUserType in dvUserType)
     {
         UserTypes userType = new UserTypes();
         listUserTypes.Add(UserTypeBO.GetUserTypes(Convert.ToInt32(drvUserType["UserTypeID"])));
     }
     return listUserTypes;
 }
コード例 #3
0
        // POST api/usertype
        public UserTypes Post(UserTypes userType)
        {
            if (userType.GUID > 0)
            {
                userType.UserTypeID = userType.GUID;
                int rowResult = UserTypeBO.UpdateUserTypes(userType);

                //Return Back to The Client               
                return userType;               
            }
            else
            {                               
                int rowResult = UserTypeBO.InsertUserTypes(userType);

                //Return Back to The Client               
                return userType;
            }
        }
コード例 #4
0
        public int InsertUserTypes(UserTypes objUserTypes)
        {
            objUserTypes.UserTypeID = 1;
            BeginTransaction();

            try
            {
                objUserTypes.UserTypeID = Insert(objUserTypes);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objUserTypes.UserTypeID = -1;
            }

            return objUserTypes.UserTypeID;
        }
コード例 #5
0
        public int UpdateUserTypes(UserTypes objUserTypes)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "UserTypeDesc", "UserTypeCode", "SyncStatus","UpdatedBy", "UpdatedDate" };
                rowsaffected = Update(objUserTypes, UpdateProperties);

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
コード例 #6
0
ファイル: UserTypeBO.cs プロジェクト: ayushman2013/SaMI.WebV2
 public static int UpdateUserTypes(UserTypes objUserTypes)
 {
     return new UserTypeDAO().UpdateUserTypes(objUserTypes);
 }
コード例 #7
0
ファイル: UserTypeBO.cs プロジェクト: ayushman2013/SaMI.WebV2
 public static UserTypes GetUserTypes(int UserTypeID)
 {
     UserTypes objUserTypes = new UserTypes();
     return (UserTypes)(new UserTypeDAO().FillDTO(objUserTypes, "UserTypeID=" + UserTypeID));
 }
コード例 #8
0
ファイル: UserTypeBO.cs プロジェクト: ayushman2013/SaMI.WebV2
 public static int InsertUserTypes(UserTypes objUserTypes)
 {
     return new UserTypeDAO().InsertUserTypes(objUserTypes);
 }