Esempio n. 1
0
        private bool HandleExternalUrl()
        {
            string decrypted = EncryptionHelper.decrypt(Request.QueryString["param"], null);
            var    parsed    = HttpUtility.ParseQueryString(decrypted);

            if (string.IsNullOrEmpty(parsed["_a"]) || string.IsNullOrEmpty(parsed["_e"]) || string.IsNullOrEmpty(parsed["_p"]) || string.IsNullOrEmpty(parsed["_c"]))
            {
                return(false);
            }


            UrlKeyRequest reqkey = new UrlKeyRequest();

            reqkey.keyId = Server.UrlEncode(Request.QueryString["param"]);
            _systemService.SessionHelper.Set("AccountId", parsed["_a"]);



            AuthenticateRequest req = new AuthenticateRequest();

            req.UserName = parsed["_e"];
            req.Password = parsed["_p"];
            _systemService.SessionHelper.Set("AccountId", parsed["_a"]);
            AuthenticateResponse resp = _systemService.Authenticate(req);

            if (!resp.Success)
            {
                return(false);
            }
            if (resp.User.languageId == 2)
            {
                _systemService.SessionHelper.SetLanguage("ar");
            }
            else
            {
                _systemService.SessionHelper.SetLanguage("en");
            }
            RecordResponse <KeyId> keyresp = _systemService.ChildGetRecord <KeyId>(reqkey);

            if (!keyresp.Success)
            {
                return(false);
            }
            _systemService.SessionHelper.Set("CompanyName", " ");

            _systemService.SessionHelper.SetUserType(resp.User.userType);
            _systemService.SessionHelper.SetEmployeeId(resp.User.employeeId);
            _systemService.SessionHelper.Set("CurrentUserName", parsed["_e"]);

            _systemService.SessionHelper.Set("IsAdmin", resp.User.isAdmin);
            StoreSystemDefaults();
            string url = PageLookup.GetPageUrlByClassId(Convert.ToInt32(parsed["_c"])) + "?" + parsed["_k"].Replace('#', '&');

            X.Call("openNewTab", parsed["_c"], url, GetGlobalResourceObject("Classes", "Class" + parsed["_c"]), "icon-Employees");
            //Response.Redirect("Default.aspx");
            return(true);
        }
Esempio n. 2
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();
                RecordResponse <Letter> response = _systemService.ChildGetRecord <Letter>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object


                this.BasicInfoTab.SetValues(response.result);

                //ltId.Select(response.result.ltId);



                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        private object GetDateFormat()
        {
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            req.Key = "dateFormat";
            RecordResponse <KeyValuePair <string, string> > response = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);

            if (!response.Success)
            {
            }
            return(response.result.Value);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                SetExtLanguage();
                HideShowButtons();
                try
                {
                    AccessControlApplier.ApplyAccessControlOnPage(typeof(Model.Employees.Profile.ImportEmployees), null, null, null, null);
                }
                catch (AccessDeniedException exp)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show();
                    Viewport1.Hidden = true;
                    return;
                }
                BatchStatusRequest req = new BatchStatusRequest();
                req.classId = ClassId.TAOT;
                RecordResponse <BatchOperationStatus> resp = _systemService.ChildGetRecord <BatchOperationStatus>(req);
                if (!resp.Success || resp.result == null)
                {
                    return;
                }
                switch (resp.result.status)
                {
                case 0:
                    Viewport1.ActiveIndex = 0;
                    break;

                case 1:


                    Viewport1.ActiveIndex = 1;
                    this.ResourceManager1.AddScript("{0}.startTask('longactionprogress');", this.TaskManager1.ClientID); break;

                case 2:
                    Viewport1.ActiveIndex = 1;
                    this.ResourceManager1.AddScript("{0}.startTask('longactionprogress');", this.TaskManager1.ClientID); break;

                case 3:
                    Viewport1.ActiveIndex = 2;
                    break;

                default: Viewport1.ActiveIndex = 0; break;
                }
            }
        }
Esempio n. 5
0
        private string GetNameFormat()
        {
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            req.Key = "nameFormat";
            RecordResponse <KeyValuePair <string, string> > response = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);

            if (!response.Success)
            {
            }
            string paranthized = response.result.Value;

            paranthized = paranthized.Replace('{', ' ');
            paranthized = paranthized.Replace('}', ',');
            paranthized = paranthized.Substring(0, paranthized.Length - 1);
            paranthized = paranthized.Replace(" ", string.Empty);
            return(paranthized);
        }
Esempio n. 6
0
        private string GetNameFormat()
        {
            string format = "";
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            req.Key = "nameFormat";
            RecordResponse <KeyValuePair <string, string> > r = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);

            if (!r.Success)
            {
                Common.errorMessage(r);;
                return(null);
            }
            format = r.result.Value;
            if (string.IsNullOrEmpty(r.result.Value))
            {
                PostRequest <KeyValuePair <string, string> > request = new PostRequest <KeyValuePair <string, string> >();
                request.entity = new KeyValuePair <string, string>("nameFormat", "{firstName} {lastName}");
                PostResponse <KeyValuePair <string, string> > resp = _systemService.ChildAddOrUpdate <KeyValuePair <string, string> >(request);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    return(null);
                }
                format = "{firstName} {lastName}";
            }


            string paranthized = format;

            paranthized = paranthized.Replace('{', ' ');
            paranthized = paranthized.Replace('}', ',');
            paranthized = paranthized.Substring(0, paranthized.Length - 1);
            paranthized = paranthized.Replace(" ", string.Empty);
            return(paranthized);
        }
Esempio n. 7
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            try
            {
                string          obj           = e.ExtraParams["values"];
                string          ldMethodParam = e.ExtraParams["ldMethod"];
                string          ldValueParam  = e.ExtraParams["ldValue"];
                loanSelfService b             = JsonConvert.DeserializeObject <loanSelfService>(obj);

                string id = e.ExtraParams["id"];
                if (string.IsNullOrEmpty(id))
                {
                    if (!string.IsNullOrEmpty(ldValueParam))
                    {
                        b.ldValue = Convert.ToDouble(ldValueParam);
                    }
                    if (!string.IsNullOrEmpty(ldMethodParam))
                    {
                        b.ldMethod = Convert.ToInt16(ldMethodParam);
                    }

                    if (b.ldMethod == null)
                    {
                        req.Key = "ldMethod";
                        RecordResponse <KeyValuePair <string, string> > defaults = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);
                        if (!defaults.Success)
                        {
                            Common.errorMessage(defaults);
                            return;
                        }
                        if (!string.IsNullOrEmpty(defaults.result.Value))
                        {
                            b.ldMethod = Convert.ToInt16(defaults.result.Value);
                        }
                    }
                    if (b.ldValue == null)
                    {
                        req.Key = "ldValue";
                        RecordResponse <KeyValuePair <string, string> > ldValueResponse = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);
                        if (!ldValueResponse.Success)
                        {
                            Common.errorMessage(ldValueResponse);
                            return;
                        }
                        if (!string.IsNullOrEmpty(ldValueResponse.result.Value))
                        {
                            b.ldValue = Convert.ToInt16(ldValueResponse.result.Value);
                        }
                    }
                }
                if (b.ldMethod == null)
                {
                    X.MessageBox.Alert(GetGlobalResourceObject("Common", "Error").ToString(), GetGlobalResourceObject("Errors", "emptyLdMethod").ToString()).Show();
                    return;
                }



                //if (string.IsNullOrEmpty(ldMethod)
                //b.ldMethod =Convert.ToInt16( ldMethod);
                // Define the object to add or edit as null


                //if (ldMethodCom.SelectedItem != null)
                //    b.ldMethod = ldMethodCom.SelectedItem.Value;

                if (date.ReadOnly)
                {
                    b.date = DateTime.Now;
                }
                //b.effectiveDate = new DateTime(b.effectiveDate.Year, b.effectiveDate.Month, b.effectiveDate.Day, 14, 0, 0);

                if (branchId.SelectedItem != null)
                {
                    b.branchName = branchId.SelectedItem.Text;
                }


                if (string.IsNullOrEmpty(id))
                {
                    try
                    {
                        //New Mode
                        //Step 1 : Fill The object and insert in the store
                        PostRequest <loanSelfService> request = new PostRequest <loanSelfService>();
                        request.entity            = b;
                        request.entity.employeeId = _systemService.SessionHelper.GetEmployeeId();
                        //  request.entity.employeeName = new EmployeeName() { fullName="" };
                        request.entity.date = DateTime.Now;
                        //request.entity.ltName = "";
                        //request.entity.currencyRef = "";



                        request.entity.apStatus = "1";
                        PostResponse <loanSelfService> r = _selfServiceService.ChildAddOrUpdate <loanSelfService>(request);
                        //check if the insert failed
                        if (!r.Success)//it maybe be another condition
                        {
                            //Show an error saving...
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);
                            return;
                        }

                        else
                        {
                            Store1.Reload();
                            //b.recordId = r.recordId;

                            ////Add this record to the store
                            //this.Store1.Insert(0, b);

                            //Display successful notification
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordSavingSucc
                            });
                            recordId.Text = b.recordId;
                            SetTabPanelEnable(true);
                            currentCase.Text = b.recordId;

                            RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                            sm.DeselectAll();
                            sm.Select(b.recordId.ToString());

                            this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                    }
                }
                else
                {
                    //Update Mode

                    try
                    {
                        //getting the id of the record
                        PostRequest <loanSelfService> request = new PostRequest <loanSelfService>();
                        request.entity            = b;
                        request.entity.employeeId = _systemService.SessionHelper.GetEmployeeId();



                        PostResponse <loanSelfService> r = _selfServiceService.ChildAddOrUpdate <loanSelfService>(request);                    //Step 1 Selecting the object or building up the object for update purpose

                        //Step 2 : saving to store

                        //Step 3 :  Check if request fails
                        if (!r.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);
                            return;
                        }
                        else
                        {
                            Store1.Reload();

                            // ModelProxy record = this.Store1.GetById(id);
                            // BasicInfoTab.UpdateRecord(record);
                            // record.Set("currencyRef", b.currencyRef);
                            // if (date.ReadOnly)
                            //     record.Set("date", null);

                            // record.Set("employeeName", b.employeeName);

                            //// record.Set("branchName", b.branchName);

                            // record.Commit();
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordUpdatedSucc
                            });
                            this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                    }
                }
            }
            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, ex.Message).Show();
            }
        }
Esempio n. 8
0
        private void BuildSchedule(List <FlatSchedule> items)
        {
            string dailyScheduleVariation;
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            req.Key = "dailySchedule";
            RecordResponse <KeyValuePair <string, string> > SystemDefaultResponse = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);

            if (!SystemDefaultResponse.Success)
            {
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", SystemDefaultResponse.ErrorCode) != null ? GetGlobalResourceObject("Errors", SystemDefaultResponse.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + SystemDefaultResponse.LogId : SystemDefaultResponse.Summary).Show();
                return;
            }
            if (string.IsNullOrEmpty(SystemDefaultResponse.result.Value))
            {
                dailyScheduleVariation = "60";
            }
            else
            {
                dailyScheduleVariation = SystemDefaultResponse.result.Value;
            }



            string html = @"<div style = 'margin: 5px auto; width: 99%; height: 98%; overflow:auto;' > 
                             <table id = 'tbCalendar' cellpadding = '5' cellspacing = '0'  style='width:auto;'>";



            //string startAt, closeAt = string.Empty;
            //GetBranchSchedule(out startAt, out closeAt);
            string startAt = items.Count != 0 ? items.Min(x => x.dtFrom.TimeOfDay).ToString() : "00:00";
            string closeAt = items.Count != 0 ? items.Max(x => x.dtTo.TimeOfDay).ToString() : "00:00";

            if (string.IsNullOrEmpty(startAt) || string.IsNullOrEmpty(closeAt))
            {
                html += @"</table></div>";
                this.pnlSchedule.Html = html;
                X.Msg.Alert(Resources.Common.Error, (string)GetLocalResourceObject("ErrorBranchWorkingHours")).Show();
                return;
            }


            TimeSpan tsStart = TimeSpan.Parse(startAt);
            //timeFrom.MinTime = tsStart;
            //timeTo.MinTime = tsStart.Add(TimeSpan.FromMinutes(30));
            TimeSpan tsClose = TimeSpan.Parse(closeAt);
            //timeTo.MaxTime = tsClose;

            TimeSpan EmployeeTsStart, EmployeeTsEnd;


            //items.ForEach(x =>
            //{
            //    string newFrom = "";
            //    string newTo = "";
            //    List<string> fromList = x.dtFrom.TimeOfDay.Split(':').ToList();
            //    if (fromList.Count==2)
            //    {
            //        newFrom = (Convert.ToInt32(fromList.First()) % 24).ToString();
            //        newFrom += ":" + fromList.ElementAt(1);
            //        EmployeeTsStart = TimeSpan.Parse(newFrom);
            //    }
            //    else
            //        EmployeeTsStart = TimeSpan.Parse(x.from);



            //    List<string> ToList = x.to.Split(':').ToList();
            //    if (ToList.Count == 2)
            //    {
            //        newTo = (Convert.ToInt32(ToList.First()) % 24).ToString();
            //        newTo += ":" + ToList.ElementAt(1);
            //        EmployeeTsEnd = TimeSpan.Parse(newTo);
            //    }
            //    else
            //        EmployeeTsEnd = TimeSpan.Parse(x.to);

            //    if (EmployeeTsStart < tsStart || EmployeeTsEnd > tsClose)
            //    {
            //        html += @"</table></div>";
            //        this.pnlSchedule.Html = html;
            //        X.Call("DisableTools");
            //        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", "ErrorEmployeeTimeOutside").ToString() + x.employeeName).Show();
            //        return;
            //    }
            //});

            //Filling The Times Slot
            List <TimeSlot> timesList = new List <TimeSlot>();
            DateTime        dtStart   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, tsStart.Hours, tsStart.Minutes, 0);
            DateTime        dtEnd;

            if (tsStart > tsClose)
            {
                DateTime endDate = DateTime.Now;
                endDate = endDate.AddDays(1);
                dtEnd   = new DateTime(endDate.Year, endDate.Month, endDate.Day, tsClose.Hours, tsClose.Minutes, 0);
            }
            else
            {
                dtEnd = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, tsClose.Hours, tsClose.Minutes, 0);
            }

            if (dtEnd == dtStart)
            {
                dtEnd = dtEnd.AddDays(1).AddMinutes(-Convert.ToInt32(dailyScheduleVariation));
            }
            int counter = 0;

            do
            {
                TimeSlot ts = new TimeSlot();
                ts.ID   = dtStart.ToString("HH:mm");
                ts.Time = dtStart.ToString("HH:mm");
                timesList.Add(ts);
                dtStart = dtStart.AddMinutes(Convert.ToInt32(dailyScheduleVariation));
                counter++;
            } while (dtStart <= dtEnd && !string.IsNullOrEmpty(dailyScheduleVariation) && counter != 3000);

            //filling the Day slots
            //int totalDays = Convert.ToInt32(Math.Ceiling((dateTo.SelectedDate - dateFrom.SelectedDate).TotalDays));

            html = FillFirstRow(html, timesList);

            html = FillOtherRow(html, timesList, items);


            //Preparing the ids to get colorified
            List <string> listIds = new List <string>();
            List <string> listDn  = new List <string>();
            List <string> listDS  = new List <string>();

            Dictionary <string, int> dic = new Dictionary <string, int>();

            if (items.Count != 0 && items != null)
            {
                DateTime activeDate = items[0].dtFrom;
                DateTime fsfromDate, fsToDate;

                foreach (FlatSchedule fs in items)
                {
                    DateTime from = fs.dtFrom;
                    DateTime to   = fs.dtTo;
                    counter = 0;
                    while (to > from && counter != 3000)
                    {
                        if (from.ToString("HH:mm") == "00:00")
                        {
                            listIds.Add(fs.employeeId + "_" + from.AddDays(-1).ToString("HH:mm"));
                            listDn.Add(fs.employeeId + "_" + fs.departmentId + "_" + from.AddDays(-1).ToString("HH:mm"));
                            listDS.Add(fs.departmentId.ToString());
                            from = from.AddMinutes(Convert.ToInt32(SystemDefaultResponse.result.Value));
                            counter++;
                            continue;
                        }
                        listIds.Add(fs.employeeId + "_" + from.ToString("HH:mm"));
                        listDn.Add(fs.employeeId + "_" + fs.departmentId + "_" + from.ToString("HH:mm"));
                        listDS.Add(fs.departmentId.ToString());

                        from = from.AddMinutes(Convert.ToInt32(SystemDefaultResponse.result.Value));
                        counter++;
                    }
                }

                listDn = listDn.Distinct().ToList();
                listDS = listDS.Distinct().ToList();
                //listDS.ForEach(departmentID => dic.Add(departmentID+, listDn.Where(stringToCheck => stringToCheck.Contains(departmentID)).Count()));

                fsfromDate = new DateTime(activeDate.Year, activeDate.Month, activeDate.Day, Convert.ToInt32(startAt.Split(':')[0]), Convert.ToInt32(startAt.Split(':')[1]), 0);
                fsToDate   = new DateTime(activeDate.Year, activeDate.Month, activeDate.Day, Convert.ToInt32(closeAt.Split(':')[0]), Convert.ToInt32(closeAt.Split(':')[1]), 0);
                if (fsfromDate >= fsToDate)
                {
                    fsToDate = fsToDate.AddDays(1);
                }
                counter = 0;
                do
                {
                    listDS.ForEach(departmentID =>
                    {
                        if (!dic.ContainsKey(departmentID + "-" + fsfromDate.ToString("HH:mm")))
                        {
                            dic.Add(departmentID + "-" + fsfromDate.ToString("HH:mm"), listDn.Where(stringToCheck => stringToCheck.Contains(departmentID + "_" + fsfromDate.ToString("HH:mm"))).Count());
                        }
                    });
                    fsfromDate = fsfromDate.AddMinutes(Convert.ToInt32(SystemDefaultResponse.result.Value));

                    counter++;
                } while (fsToDate >= fsfromDate && counter != 3000);
            }


            //var department= items.GroupBy(x => x.departmentId);
            //foreach (var de in department)
            //{

            //    fsfromDate = new DateTime(activeDate.Year, activeDate.Month, activeDate.Day, Convert.ToInt32(startAt.Split(':')[0]), Convert.ToInt32(startAt.Split(':')[1]), 0);
            //    fsToDate = new DateTime(activeDate.Year, activeDate.Month, activeDate.Day, Convert.ToInt32(closeAt.Split(':')[0]), Convert.ToInt32(closeAt.Split(':')[1]), 0);
            //    List<FlatSchedule> employee = de.ToList();


            //    do
            //    {
            //        listDn.Add(employee[0].departmentId + "-" + fsfromDate.ToString("HH:mm"));
            //        int sum = 0;
            //        employee.ForEach(x =>
            //        {
            //          int employeeFromHour=  Convert.ToInt32(x.from.Split(':')[0]);
            //          int employeeToHour = Convert.ToInt32(x.to.Split(':')[0]);

            //            int employeeFromMintues= Convert.ToInt32(x.from.Split(':')[1]);
            //            int employeeTMintues = Convert.ToInt32(x.to.Split(':')[1]);
            //            double employeeFromTotal = employeeFromHour * 100 + employeeFromMintues;
            //            double employeeToTotal = employeeToHour * 100 + employeeTMintues;
            //            double FsTotal = fsfromDate.Hour * 100 + fsfromDate.Minute;
            //            if (FsTotal >= employeeFromTotal && FsTotal <= employeeToTotal)
            //                sum++;

            //        }
            //        );
            //        listDS.Add(sum);
            //        fsfromDate = fsfromDate.AddMinutes(30);
            //    } while (fsToDate >= fsfromDate);


            //}



            var           d           = items.GroupBy(x => x.employeeId);
            List <string> totaldayId  = new List <string>();
            List <string> totaldaySum = new List <string>();

            d.ToList().ForEach(x =>
            {
                totaldayId.Add(x.ToList()[0].employeeId + "_Total");
                totaldaySum.Add(timeConverter(x.ToList().Sum(y => Convert.ToInt32(y.duration)), true));
            });
            //List<string> employeeList = new List<string>();
            //items.ForEach(x => employeeList.Add(x.employeeId.ToString()));

            html = FillSummaryRow(html, timesList, dic);

            html += @"</table></div>";
            this.pnlSchedule.Html = html;
            X.Call("ColorifySchedule", JSON.JavaScriptSerialize(listIds));

            X.Call("filldaytotal", totaldayId, totaldaySum);
            //X.Call("filldepartmentTotal", listDn, listDS);
            X.Call("filldepartmentTotal", dic);
            X.Call("employeeClick", items);
            //X.Call("Init");
            //X.Call("DisableTools");
            X.Call("FixHeader");
        }
Esempio n. 9
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            DeactivatePassword(true);
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            switch (type)
            {
            case "ColFullName":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();
                RecordResponse <UserInfo> response = _systemService.ChildGetRecord <UserInfo>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, response.Summary).Show();
                    return;
                }
                //Step 2 : call setvalues with the retrieved object

                PasswordConfirmation.Text = response.result.password;
                if (!String.IsNullOrEmpty(response.result.employeeId))
                {
                    RecordRequest empRecord = new RecordRequest();
                    empRecord.RecordID = response.result.employeeId;
                    RecordResponse <Employee> empResponse = _employeeService.Get <Employee>(empRecord);

                    RecordRequest req = new RecordRequest();

                    employeeId.GetStore().Add(new object[]
                    {
                        new
                        {
                            recordId = response.result.employeeId,
                            fullName = empResponse.result.name.fullName
                        }
                    });
                    employeeId.SetValue(response.result.employeeId);
                }
                this.BasicInfoTab.SetValues(response.result);

                // InitCombos(response.result);
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "colDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "colAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
Esempio n. 10
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            string id   = e.ExtraParams["id"];
            string type = e.ExtraParams["type"];
            string path = e.ExtraParams["path"];

            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id;

                RecordResponse <CompanyRightToWork> response = _systemService.ChildGetRecord <CompanyRightToWork>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                recordId.Text = response.result.recordId;

                url.Text = response.result.fileUrl;
                this.BasicInfoTab.SetValues(response.result);

                FillDocumentType();
                dtId.Select(response.result.dtId.ToString());

                FillBranch();
                if (response.result.branchId.HasValue)
                {
                    branchId.Select(response.result.branchId.Value.ToString());
                }
                SetHijriInputState(response.result.hijriCal);
                if (_systemService.SessionHelper.GetHijriSupport())
                {
                    SetHijriInputState(response.result.hijriCal);
                    if (response.result.hijriCal)
                    {
                        hijCal.Checked = true;

                        rwIssueDateMulti.Text = response.result.issueDate != null?response.result.issueDate.ToString("yyyy/MM/dd", new CultureInfo("ar")) : "";

                        rwExpiryDateMulti.Text = response.result.expiryDate != null?response.result.expiryDate.ToString("yyyy/MM/dd", new CultureInfo("ar")) : "";

                        hijriSelected.Text = "true";
                    }
                    else
                    {
                        gregCal.Checked = true;

                        rwIssueDateMulti.Text  = "";
                        rwExpiryDateMulti.Text = "";
                        hijriSelected.Text     = "false";
                    }
                    X.Call("handleInputRender");
                }
                else
                {
                    SetHijriInputState(false);
                }

                rwFile.EmptyText = response.result.fileName;
                rwFile.ReRender();
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":
                DownloadFile(path);
                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
Esempio n. 11
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;

                if (
                    HttpRuntime.Cache.Get("ErrorMsgGenEM") != null ||
                    HttpRuntime.Cache.Get("ErrorLogIdGenEM") != null ||
                    HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                {
                    X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", "Error_" + HttpRuntime.Cache.Get("ErrorErrorCodeGenEM")) != null ? GetGlobalResourceObject("Errors", "Error_" + HttpRuntime.Cache.Get("ErrorErrorCodeGenEM").ToString()).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + HttpRuntime.Cache.Get("ErrorLogIdGenEM").ToString() : HttpRuntime.Cache.Get("ErrorMsgGenEM").ToString()).Show();
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    mailWindow.Close();


                    if (HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorErrorCodeGenEM");
                    }
                    if (HttpRuntime.Cache.Get("ErrorLogIdGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorLogIdGenEM");
                    }
                    if (HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorErrorCodeGenEM");
                    }

                    return;
                }


                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["genEM_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["genEM_RecordId"].ToString();
                }
                else
                {
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    mailWindow.Close();
                    Viewport1.ActiveIndex = 0;

                    return;
                }
                if (resp.result.errorId != null)
                {
                    X.Msg.Alert(Resources.Common.Error, resp.result.errorName).Show();
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);


                    mailWindow.Close();
                    return;
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        mailWindow.Close();
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();

                        this.mailEmployeesProgressBar.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        HttpRuntime.Cache.Remove("genEM_RecordId");
                        mailWindow.Close();


                        X.Msg.Alert("", Resources.Common.operationCompleted).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Esempio n. 12
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;
                if (HttpRuntime.Cache.Get("ExceptionMsgSync") != null)

                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ExceptionMsgSync").ToString()).Show();
                    deleteFromCash();
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }
                if (HttpRuntime.Cache.Get("ErrorMsgSync") != null || HttpRuntime.Cache.Get("LogIdMsgSync") != null)

                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ErrorMsgSync").ToString() + "<br>" + Resources.Errors.ErrorLogId + HttpRuntime.Cache.Get("LogIdMsgSync").ToString() + "<br>").Show();

                    deleteFromCash();


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }


                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    deleteFromCash();
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["syncAC_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["syncAC_RecordId"].ToString();
                }
                else
                {
                    // this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);

                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);

                    deleteFromCash();

                    return;
                }
                if (resp.result.errorId != null)
                {
                    X.Msg.Alert(Resources.Common.Error, resp.result.errorName).Show();
                    deleteFromCash();
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);

                        deleteFromCash();

                        X.Msg.Alert("", Resources.Common.SyncSucc).Show();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(" {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                        //  this.payListProgressBar.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        deleteFromCash();
                        //EditGenerateWindow.Close();
                        //Store1.Reload();

                        //payListWidow.Close();
                        X.Msg.Alert("", Resources.Common.operationCompleted).Show();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(" {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
                deleteFromCash();
            }
        }
Esempio n. 13
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;
                if (HttpRuntime.Cache.Get("ErrorMsgGenAD") != null || HttpRuntime.Cache.Get("ErrorLogIdGenAD") != null)
                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ErrorMsgGenAD").ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + HttpRuntime.Cache.Get("ErrorLogIdGenAD").ToString()).Show();


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }

                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["genFS_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["genFS_RecordId"].ToString();
                }
                else
                {
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (resp.result == null || resp.result.errorId != null)
                {
                    //string[] values;
                    //var infolist = resp.result.infoList.Split(',');
                    //string ErrorMessage;
                    //if (GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId) != null)

                    //    values = GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId).ToString().Split(new string[] { "%s" }, StringSplitOptions.None);
                    //    for (int i = 0; i < infolist.Length; i++)
                    //    {

                    //        values[0] += infolist[i] + "  ";
                    //    }
                    //    if (values.Length == 2)
                    //        ErrorMessage = values[0] + " " + values[1];
                    //    else
                    //        ErrorMessage = values[0];
                    //}
                    //else
                    //    ErrorMessage = GetGlobalResourceObject("Errors", "Error_2").ToString() + resp.ErrorCode;


                    //X.Msg.Alert(Resources.Common.Error, ErrorMessage).Show();
                    if (resp.result.errorId != null)
                    {
                        X.MessageBox.Alert(Resources.Common.Error, resp.result.errorName + "<br>" + Resources.Errors.ErrorLogId + resp.result.errorId + "<br>").Show();
                    }
                    else
                    {
                        Common.errorMessage(resp);
                    }


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        HttpRuntime.Cache.Remove("genFS_RecordId");
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Esempio n. 14
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            panelRecordDetails.ActiveIndex = 0;
            DeactivatePassword(true);
            userGroups.Disabled = false;
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            CurrentUser.Text = id.ToString();
            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();

                RecordResponse <UserInfo> response = _systemService.ChildGetRecord <UserInfo>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object

                PasswordConfirmation.Text = response.result.password;
                this.BasicInfoTab.SetValues(response.result);
                if (response.result.activeStatus == Convert.ToInt16(ActiveStatus.INACTIVE))
                {
                    isInactiveCheck.Checked = true;
                }
                else
                {
                    isInactiveCheck.Checked = false;
                }


                if (!String.IsNullOrEmpty(response.result.employeeId))
                {
                    RecordRequest empRecord = new RecordRequest();
                    empRecord.RecordID = response.result.employeeId;
                    RecordResponse <Employee> empResponse = _employeeService.Get <Employee>(empRecord);

                    RecordRequest req = new RecordRequest();

                    employeeId.GetStore().Add(new object[]
                    {
                        new
                        {
                            recordId = response.result.employeeId,
                            fullName = empResponse.result.name.fullName
                        }
                    });
                    employeeId.SetValue(response.result.employeeId);

                    X.Call("SetNameEnabled", false, empResponse.result.name.fullName);
                }
                pro.Hidden = true;

                // InitCombos(response.result);
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();


                AllGroupsStore.Reload();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }