public ActionResult RejectDocument(int iInboxItemID, string strMessenger, string strRemark)
        {
            AuthConfig.SetMailConfig();
            ADInboxItemsInfo InboxItem = (ADInboxItemsInfo) new ADInboxItemsController().GetObjectByID(iInboxItemID);

            InboxItem.ADInboxItemMessage = strMessenger;
            InboxItem.ADInboxItemRemark  = strRemark;
            ADUsersInfo CurrentUserInfo = (ADUsersInfo) new ADUsersController().GetObjectByName(Convert.ToString(AuthConfig.GetSession("CurrentUser")));

            MailUtil.RejectDocument(InboxItem, CurrentUserInfo);
            return(null);
        }
Example #2
0
 public bool CheckUserApprovalMailBox(ADInboxItemsInfo InboxItemInfo, string strUserName)
 {
     string[] strListUsers = InboxItemInfo.ADMailToUsers.Split(';');
     foreach (string strUser in strListUsers)
     {
         if (strUser == strUserName)
         {
             return(true);
         }
     }
     return(false);
 }
Example #3
0
        public bool CheckUnReadMailBox(ADInboxItemsInfo InboxItemInfo, string strUserName)
        {
            #region Check Approval
            if (InboxItemInfo.ADInboxItemProtocol == MailUtil.strProtocol_Approval &&
                string.IsNullOrEmpty(InboxItemInfo.ADInboxItemAction))
            {
                return(true);
            }
            #endregion

            #region Check User Read
            string[] strListUsers = InboxItemInfo.ADMailReadUsers.Split(';');
            foreach (string strUser in strListUsers)
            {
                if (strUser == strUserName)
                {
                    return(false);
                }
            }
            #endregion

            return(true);
        }
        public ActionResult ShowSubScreenApproved(string[] InboxItem)
        {
            HomeModels             home          = new HomeModels();
            ADInboxItemsController InboxItemCtrl = new ADInboxItemsController();
            ADInboxItemsInfo       objInboxItem  = (ADInboxItemsInfo)InboxItemCtrl.GetObjectByID(Convert.ToInt32(InboxItem[0]));
            string strView = "ShowSubScreenApproved";

            if (objInboxItem.ADInboxItemAction == "Rejected")
            {
                strView = "ShowSubScreenMessage";
            }
            bool isUnRead = home.CheckUnReadMailBox(objInboxItem, Convert.ToString(AuthConfig.GetSession("CurrentUser")));

            if (isUnRead)
            {
                if (!string.IsNullOrEmpty(objInboxItem.ADMailReadUsers) && objInboxItem.ADMailReadUsers.EndsWith(";") == false)
                {
                    objInboxItem.ADMailReadUsers += ";";
                }
                objInboxItem.ADMailReadUsers += Convert.ToString(AuthConfig.GetSession("CurrentUser")) + ";";
                InboxItemCtrl.UpdateObject(objInboxItem, false, "ADMailReadUsers");
            }

            #region Protocol: Approval
            if (objInboxItem.ADInboxItemProtocol == MailUtil.strProtocol_Approval)
            {
                if (String.IsNullOrEmpty(objInboxItem.ADInboxItemAction) && home.CheckUserApprovalMailBox(objInboxItem, Convert.ToString(AuthConfig.GetSession("CurrentUser"))))
                {
                    ViewData["approvalDisable"] = "";
                    ViewData["rejectDisable"]   = "";
                }
                else
                {
                    ViewData["approvalDisable"] = "disabled";
                    ViewData["rejectDisable"]   = "disabled";
                }

                if (!string.IsNullOrEmpty(objInboxItem.ADInboxItemAction))
                {
                    ViewData["ModalTitle"] = string.Format("{0} ({1})", objInboxItem.ADInboxItemDocNo, objInboxItem.ADInboxItemAction);
                }
                else
                {
                    ViewData["ModalTitle"] = string.Format("Waiting for Approve: {0}", objInboxItem.ADInboxItemDocNo);
                }

                ViewData["inboxID"]   = InboxItem[0];
                ViewData["InboxInfo"] = objInboxItem;

                ViewData["createUser"] = new HREmployeesController().GetObjectNameByID(objInboxItem.FK_HRFromEmployeeID);

                string sApprovalStep = Convert.ToString(new ADApprovalProcStepsController().GetObjectColumnByID(objInboxItem.FK_ADApprovalProcStepID, "ADApprovalProcStepLevel"));
                if (string.IsNullOrEmpty(sApprovalStep))
                {
                    sApprovalStep = new HREmployeesController().GetObjectNameByID(home.GetEmployeeManagerLevel(objInboxItem.FK_HRFromEmployeeID, "FK_ReportToEmployeeID"));
                }
                ViewData["sApprovalStep"] = sApprovalStep;
                //strView = "ShowSubScreenApproved";
            }
            #endregion

            #region Protocol: Message
            else if (objInboxItem.ADInboxItemProtocol == MailUtil.strProtocol_Message)
            {
                DataSet dsMessageItems = new ADMessageItemsController().GetAllDataByForeignColumn("FK_ADInboxItemID", objInboxItem.ADInboxItemID);
                ViewData["ModalTitle"] = objInboxItem.ADInboxItemSubject;
                ViewData["InboxInfo"]  = objInboxItem;
                strView = "ShowSubScreenMessage";
            }
            #endregion
            ViewData["resultDetail"] = new DataTable();
            ViewData["listCol"]      = new List <STGridColumnsInfo>();
            Dictionary <List <STGridColumnsInfo>, DataSet> dicInfo = home.GetScreenEmployeeOffWork(objInboxItem.ADInboxItemDocType, objInboxItem.ADInboxItemObjectID);
            if (dicInfo != null)
            {
                KeyValuePair <List <STGridColumnsInfo>, DataSet> dic = dicInfo.FirstOrDefault();
                ViewData["listCol"] = dic.Key;
                if (dic.Value != null && dic.Value.Tables.Count > 0)
                {
                    ViewData["resultDetail"] = dic.Value.Tables[0];
                }
            }

            return(PartialView(strView));
        }
Example #5
0
        public Dictionary <List <STGridColumnsInfo>, DataSet> ShowModuleByJournal(String strSourceLeger, String strDocumentNo, ADInboxItemsInfo objInbox, STFieldsInfo objOldField)
        {
            STModulesController      ModuleCtrl      = new STModulesController();
            STModuleTablesController ModuleTableCtrl = new STModuleTablesController();

            int    iMainObjectID  = -1;
            String strTable       = String.Empty;
            String strTablePrefix = String.Empty;
            String strPrimaryKey  = String.Empty;
            Object MainObj        = null;

            int            iModuleID = 0;
            List <DataRow> dr        = GetLocalDataSet("STModuleID,STModuleName", "STModules", string.Format("STModuleName = '{0}'", strSourceLeger));

            if (dr.Count > 0)
            {
                iModuleID = Convert.ToInt32(dr.First()["STModuleID"]);
            }

            dr = GetLocalDataSet("STModuleTableID,STModuleTableName,STModuleID,STModuleTableLevelIndex", "STModuleTables", string.Format("STModuleID = {0} AND STModuleTableLevelIndex = 0", iModuleID));
            if (dr.Count > 0)
            {
                strTable = dr.First()["STModuleTableName"].ToString();
            }

            if (String.IsNullOrEmpty(strTable) == false)
            {
                strTablePrefix = strTable.Substring(0, strTable.Length - 1);
                strPrimaryKey  = strTablePrefix + "ID";
            }

            BaseBusinessController Ctrl = BusinessControllerFactory.GetBusinessController(strTable + "Controller");

            if (Ctrl != null)
            {
                MainObj = Ctrl.GetObjectByNo(strDocumentNo);
            }

            if (MainObj != null)
            {
                iMainObjectID = Convert.ToInt32(GMCDbUtil.GetPropertyValue(MainObj, strPrimaryKey));
                if (GMCDbUtil.GetPropertyValue(MainObj, "FK_HREmployeeID") != null)
                {
                    int iEmployeeID = Convert.ToInt32(GMCDbUtil.GetPropertyValue(MainObj, "FK_HREmployeeID"));
                    objInbox.FK_HRFromEmployeeID = iEmployeeID;
                }
                if (GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc") != null)
                {
                    //TextEdit txtRemark = (TextEdit)GetControlByName("fld_medADInboxItemRemark1");
                    //if (txtRemark != null)
                    //{
                    //    txtRemark.EditValue = GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc");
                    //}
                    objInbox.ADInboxItemMessage = Convert.ToString(GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc"));
                }
            }
            //ShowModuleByJournal(strSourceLeger, iMainObjectID, false);
            //Thang - edit 26/4/2016 hiển thị chi tiêt chứng từ

            ADUserGroupsInfo objUserGroup = AuthConfig.CurrenUserGroupInfo;

            dr = GetLocalDataSet("STScreenID,STScreenNumber,STModuleID,STUserGroupID,STScreenSortOrder", "STScreens", string.Format(@"STModuleID = {0} AND STUserGroupID = {1} 
                AND STScreenNumber like 'DM%' AND STScreenSortOrder > 0 AND STScreenSortOrder <= 1", iModuleID, objUserGroup.ADUserGroupID));
            int iScreenID = 0;

            if (dr.Count > 0)
            {
                iScreenID = Convert.ToInt32(dr.First()["STScreenID"]);
            }
            //Thang edit - 8/2/2017 Chỉnh sửa nếu 1 user group không có giao diện riêng thì sẽ lấy mặc định giao diện admin
            if (iScreenID == 0)
            {
                int iUserGroupDefaultID = new ADUserGroupsController().GetObjectIDByName("ADMIN");
                dr = GetLocalDataSet("STScreenID,STScreenNumber,STModuleID,STUserGroupID,STScreenSortOrder", "STScreens", string.Format(@"STModuleID = {0} AND STUserGroupID = {1} 
                AND STScreenNumber like 'DM%' AND STScreenSortOrder > 0 AND STScreenSortOrder <= 1", iModuleID, iUserGroupDefaultID));
                if (dr.Count > 0)
                {
                    iScreenID = Convert.ToInt32(dr.First()["STScreenID"]);
                }
            }

            dr = GetLocalDataSet("*", "STFields", string.Format(@"STScreenID = {0} AND STFieldType = 'GMCGridControl' 
                                        AND(STFieldDataSource like '%Items' OR STFieldDataSource like '%Details')
                                        AND STFieldGroup <> ''", iScreenID));
            if (dr.Count == 0)
            {
                return(null);
            }
            STFieldsInfo objField = (STFieldsInfo) new STFieldsController().GetObjectFromDataRow(dr[0]);

            if (objField == null)
            {
                return(null);
            }

            BaseBusinessController itemCtrl = BusinessControllerFactory.GetBusinessController(objField.STFieldDataSource + "Controller");
            DataSet ds = new DataSet();

            if (itemCtrl != null)
            {
                ds = itemCtrl.GetAllDataByForeignColumn("FK_" + strPrimaryKey, iMainObjectID);
            }

            List <STGridColumnsInfo> lstGridColumns = new List <STGridColumnsInfo>();

            if (objOldField == null || !objOldField.STFieldID.Equals(objField.STFieldID))
            {
                objOldField = objField;
                dr          = GetLocalDataSet("*", "STGridColumns", string.Format("FK_STFieldID = {0}", objField.STFieldID));
                STGridColumnsController GridColCtrl = new STGridColumnsController();
                dr.Distinct().ToList().ForEach(x =>
                {
                    STGridColumnsInfo colInfo = (STGridColumnsInfo)GridColCtrl.GetObjectFromDataRow(x);
                    lstGridColumns.Add(colInfo);
                });
            }
            return(new Dictionary <List <STGridColumnsInfo>, DataSet>()
            {
                { lstGridColumns, ds }
            });
        }