示例#1
0
        public async static Task<SYS_tblGroupUserDRO> InsertUpdateGroupUser(SYS_tblGroupUserDTO item, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateGroupUser", GetBaseUrl());
                var postData = new SYS_tblGroupUserDCO
                {
                    GroupID = string.IsNullOrEmpty(item.GroupID) ? "0" : item.GroupID,
                    GroupCode = item.GroupCode,
                    VNName = item.VNName,
                    ENName = item.ENName,
                    Note = item.Note,
                    IsDefault = item.IsDefault,
                    Active = item.Active,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"groupUser\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblGroupUserDAO.InsertUpdateGroupUser(url, json_data);
                if (string.IsNullOrEmpty(result.ResponseItem.Message)) result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return result;
        }
示例#2
0
 private void LoadDataToEdit(SYS_tblGroupUserDTO item)
 {
     txtGroupID.EditValue = (item == null) ? null : item.GroupID;
     txtGroupCode.EditValue = (item == null) ? null : item.GroupCode;
     //txtGroupCode.Properties.ReadOnly = (item == null) ? false : true;
     txtVNName.EditValue = (item == null) ? null : item.VNName;
     txtENName.EditValue = (item == null) ? null : item.ENName;
     mmoNote.EditValue = (item == null) ? null : item.Note;
     chkIsDefault.Checked = (item == null) ? false : item.IsDefault;
     chkActive.Checked = (item == null) ? true : item.Active;
     if (item == null)
     {
         depError.ClearErrors();
         this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false);
         txtGroupCode.Focus();
     }
 }
示例#3
0
        public SYS_tblGroupUserDTO GetDataByID(string group_user_id, string username, string language_id)
        {
            SYS_tblGroupUserDTO result = new SYS_tblGroupUserDTO();
            try
            {
                DataRow dr = db.GetDataRow("SYS_spfrmGroupUser", new string[] { "Activity", "Username", "LanguageID", "GroupID" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, group_user_id });
                if (dr != null)
                {
                    result = new SYS_tblGroupUserDTO
                    {
                        GroupID = Convert.ToInt32(dr["GroupID"]),
                        GroupCode = dr["GroupCode"] + "",
                        VNName = dr["VNName"] + "",
                        ENName = dr["ENName"] + "",
                        Note = dr["Note"] + "",
                        Active = Convert.ToBoolean(dr["Active"]),
                        IsDefault = Convert.ToBoolean(dr["IsDefault"]),
                        IsRoot = Convert.ToBoolean(dr["IsRoot"]),
                        Activity = BaseConstant.COMMAND_GET_DATA_BY_ID_EN,
                        UserID = username,
                        LanguageID = language_id,
                        Visible = Convert.ToBoolean(dr["Visible"]),
                        Creater = dr["Creater"] + "",
                        CreateTime = Convert.ToDateTime(dr["CreateTime"]),
                        Editer = dr["Editer"] + "",
                        EditTime = (dr["EditTime"] == DBNull.Value) ? (DateTime?)null : (DateTime)dr["EditTime"]
                    };

                    return result;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return result;
        }
示例#4
0
        public uc_GroupUserDetail(uc_GroupUser _parent_form, SYS_tblGroupUserDTO item = null)
        {
            CommonEngine.ShowWaitForm(this);
            InitializeComponent();
            Initialize();
            parent_form = _parent_form;

            if (item != null)
                LoadDataToEdit(item);
            CommonEngine.LoadUserPermission("9", txtGroupID, btnSaveClose, btnSaveInsert);
        }
示例#5
0
        public SYS_tblGroupUserDRO GetGroupUserByID(string Username, string LanguageID, string GroupID)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    SYS_tblGroupUserDTO temp = new SYS_tblGroupUserDTO();
                    var db = scope.Resolve<ISYS_tblGroupUserDAO>();
                    temp = db.GetDataByID(GroupID, Username, LanguageID);
                    if (temp != null)
                    {
                        result.GroupUserItem = Mapper.Map<SYS_tblGroupUserDCO>(temp);
                        result.ResponseItem = new DCO.ResponseItem
                        {
                            Result = true,
                            Status = DCO.ResponseStatus.Success,
                            Message = "",
                            RequestUser = Username,
                            TotalItemCount = 1
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result.GroupUserItem = Mapper.Map<SYS_tblGroupUserDCO>(new SYS_tblGroupUserDTO());
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Get data failed: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
示例#6
0
        public string UpdateGroupUser(SYS_tblGroupUserDTO item)
        {
            string result = "";
            try
            {
                result = db.sExecuteSQL("SYS_spfrmGroupUser", new string[] { "Activity", "Username", "LanguageID", "GroupID", "GroupCode", "VNName", "ENName", "Note", "Active", "IsDefault", "IsRoot" }, new object[] { BaseConstant.COMMAND_UPDATE_EN, item.UserID, item.LanguageID, item.GroupID, item.GroupCode, item.VNName, item.ENName, item.Note, item.Active, item.IsDefault, item.IsRoot });

                if (!string.IsNullOrEmpty(result))
                    logger.Error(result);

                return result;
            }
            catch (Exception ex)
            {
                result = ex.Message;
                logger.Error(ex);
            }

            return result;
        }