Ejemplo n.º 1
0
        protected void RadScheduler1_AppointmentContextMenuItemClicked(object sender, AppointmentContextMenuItemClickedEventArgs e)
        {
            try
            {
                if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] == "Appointment"))
                {
                    if (DateTime.Now.Day < e.Appointment.Start.Day && DateTime.Now.Month <= int.Parse(Session["MonthID"].ToString()))
                    {
                        return;
                    }

                    Session["IsEditCall"]       = 0;
                    Session["PlannedVisitID"]   = int.Parse(e.Appointment.ID.ToString());
                    Session["PlannedVisitDate"] = e.Appointment.Start;
                    Session["IsDoubleVisit"]    = -1;

                    if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null)
                    {
                        con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString());
                        //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());
                        string s = "Select Distinct AffiliationID, SpecialtyID From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());

                        cmd = new SqlCommand(s, con);
                        con.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                Session["ParticipantID"] = dr["AffiliationID"].ToString();
                                Session["SpecialtyID"]   = dr["SpecialtyID"].ToString();
                            }
                        }
                        dr.Close();
                    }
                    //else
                    //{
                    //    Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString();
                    //}

                    int aaa = 1; int bbb = 0;
                    if (aaa == bbb)
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true);
                    }
                }
                if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] != "Appointment"))
                {
                    Label1.Text = "Alert!" + "<br />" + "This Visit Already Created";
                    RadWindowManager1.RadAlert("Duplicate Visits <br /> This Appointment Has a Corresponding Visit", 400, 200, "Alert!", null, "");
                }

                if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] == "Created")
                {
                    if (DateTime.Now.Day < e.Appointment.Start.Day)
                    {
                        return;
                    }

                    Session["IsEditCall"]       = 1;
                    Session["PlannedVisitID"]   = int.Parse(e.Appointment.ID.ToString());
                    Session["PlannedVisitDate"] = e.Appointment.Start;
                    Session["IsDoubleVisit"]    = 0;

                    if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null)
                    {
                        con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString());
                        //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());
                        string s = "Select Distinct AffiliationID, SpecialtyID, IsDoubleVisit From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());

                        cmd = new SqlCommand(s, con);
                        con.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                Session["ParticipantID"] = dr["AffiliationID"].ToString();
                                Session["SpecialtyID"]   = dr["SpecialtyID"].ToString();
                                Session["IsDoubleVisit"] = dr["IsDoubleVisit"].ToString();
                            }
                        }
                        dr.Close();
                    }
                    //else
                    //{
                    //    Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString();
                    //}

                    int aaa = 1; int bbb = 0;
                    if (aaa == bbb)
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true);
                    }
                }
                if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] != "Created")
                {
                    Session["IsEditCall"] = 0;
                    Label1.Text           = "Alert!" + "<br />" + "This appointment was finally saved or you did not creat a call for it";
                    RadWindowManager1.RadAlert("This appointment was finally saved or you did not creat a call for it", 400, 200, "Alert!", null, "");
                }

                if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] != "Appointment")
                {
                    Session["IsEditCall"]       = 2;
                    Session["IsFinal"]          = e.Appointment.Attributes["Annotations"];
                    Session["PlannedVisitID"]   = int.Parse(e.Appointment.ID.ToString());
                    Session["PlannedVisitDate"] = e.Appointment.Start;
                    Session["IsDoubleVisit"]    = 0;

                    if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null)
                    {
                        con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString());
                        //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());
                        string s = "Select Distinct AffiliationID, SpecialtyID, LineID, IsDoubleVisit From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString());

                        cmd = new SqlCommand(s, con);
                        con.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                Session["ParticipantID"] = dr["AffiliationID"].ToString();
                                Session["SpecialtyID"]   = dr["SpecialtyID"].ToString();
                                Session["LineID_Sch"]    = dr["LineID"].ToString();
                                Session["IsDoubleVisit"] = dr["IsDoubleVisit"].ToString();
                            }
                        }
                        dr.Close();
                    }
                    //else
                    //{
                    //    Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString();
                    //}

                    int aaa = 1; int bbb = 0;
                    if (aaa == bbb)
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true);
                    }
                }
                if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] == "Appointment")
                {
                    Label1.Text = "Error" + "<br />" + "This appointment has no corresponding call";
                    RadWindowManager1.RadAlert("This appointment has no corresponding call", 400, 200, "Alert!", null, "");
                }

                if ((e.MenuItem.Value == "CommandDelete" || e.MenuItem.Value == "CommandEdit") && e.Appointment.Attributes["Annotations"] != "Appointment")
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
                RadWindowManager1.RadAlert(ex.Source + "<br />" + ex.Message, 400, 200, "Alert!", null, "");
            }
        }
Ejemplo n.º 2
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Save":
                if (idDaoTao == null)
                {
                    DaoTao dt = new DaoTao();
                    dt.IDNhanVien    = (int)Session["idNV"];
                    dt.IDTrinhDo     = Convert.ToInt32(cboTrinhDo.SelectedValue);
                    dt.IDLoaiHinh    = Convert.ToInt32(cboLoaiHinh.SelectedValue);
                    dt.IDNoiCapBang  = Convert.ToInt32(cboNoiDT.SelectedValue);
                    dt.TuNgay        = txtTuNgay.SelectedDate;
                    dt.DenNgay       = txtDenNgay.SelectedDate;
                    dt.IDChuyenNganh = Convert.ToInt32(cboChuyenNganh.SelectedValue);
                    dt.IDLoaiBangDT  = Convert.ToInt32(cboLoaiBang.SelectedValue);
                    dt.Anh           = imgdata;
                    dt.Type          = 0; // Type = 0 là loại bằng cấp
                    dt.NgayTao       = dt.NgayCapNhat = DateTime.Now;
                    dt.NguoiTao      = dt.NguoiCapNhat = idUser;
                    _entities.AddToDaoTaos(dt);
                    try
                    {
                        _entities.SaveChanges();
                        grvDaoTao.Rebind();
                        RadWindowManager1.RadAlert("Thêm thông tin thành công", 285, 100, "Thông báo", null);
                    }
                    catch (Exception ex)
                    {
                        RadWindowManager1.RadAlert("Thêm thông tin thất bại", 285, 100, "Lỗi", null);
                        throw ex;
                    }
                }
                else
                {
                    DaoTao daoTao = _entities.DaoTaos.Where(d => d.IDDaoTao == idDaoTao).FirstOrDefault();
                    daoTao.IDTrinhDo     = Convert.ToInt32(cboTrinhDo.SelectedValue);
                    daoTao.IDLoaiHinh    = Convert.ToInt32(cboLoaiHinh.SelectedValue);
                    daoTao.IDNoiCapBang  = Convert.ToInt32(cboNoiDT.SelectedValue);
                    daoTao.TuNgay        = txtTuNgay.SelectedDate;
                    daoTao.DenNgay       = txtDenNgay.SelectedDate;
                    daoTao.IDChuyenNganh = Convert.ToInt32(cboChuyenNganh.SelectedValue);
                    daoTao.IDLoaiBangDT  = Convert.ToInt32(cboLoaiBang.SelectedValue);
                    daoTao.Type          = 0;// Type = 0 là loại bằng cấp
                    daoTao.Anh           = imgdata;
                    daoTao.NgayCapNhat   = DateTime.Now;
                    daoTao.NguoiCapNhat  = idUser;
                    try
                    {
                        _entities.SaveChanges();
                        grvDaoTao.Rebind();
                        RadWindowManager1.RadAlert("Sửa thông tin thành công", 285, 100, "Thông báo", null);
                    }
                    catch (Exception ex)
                    {
                        RadWindowManager1.RadAlert("Sửa thông tin thất bại", 285, 100, "Lỗi", null);
                        throw ex;
                    }
                }
                break;

            case "Reset":
                cboTrinhDo.SelectedIndex  = -1;
                cboLoaiHinh.SelectedIndex = -1;
                cboNoiDT.SelectedIndex    = -1;
                txtTuNgay.Clear();
                txtDenNgay.Clear();
                cboChuyenNganh.SelectedIndex = -1;
                cboLoaiBang.SelectedIndex    = -1;
                upAnh.UploadedFiles.Clear();
                AnhScan.ImageUrl = "../Images/no_photo.jpg";
                idDaoTao         = null;
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public bool Save()
        {
            if (!access.Write)
            {
                return(false);
            }

            var contact = _dataManager.Contact.SelectById(SiteId, ContactId) ?? new tbl_Contact();

            if (contact.UserFullName != txtUserFullName.Text || !contact.IsNameChecked)
            {
                var nameChecker = new NameChecker(ConfigurationManager.AppSettings["ADONETConnectionString"]);
                var nameCheck   = nameChecker.CheckName(txtUserFullName.Text, NameCheckerFormat.FIO, Correction.Correct);
                if (!string.IsNullOrEmpty(nameCheck))
                {
                    contact.UserFullName  = nameCheck;
                    contact.Surname       = nameChecker.Surname;
                    contact.Name          = nameChecker.Name;
                    contact.Patronymic    = nameChecker.Patronymic;
                    contact.IsNameChecked = nameChecker.IsNameCorrect;
                }
                else
                {
                    contact.UserFullName  = txtUserFullName.Text;
                    contact.Name          = string.Empty;
                    contact.Surname       = string.Empty;
                    contact.Patronymic    = string.Empty;
                    contact.IsNameChecked = false;
                }
            }
            else
            {
                contact.IsNameChecked = imgbtnOk.Visible;
            }

            contact.ContactTypeID = ddlContactType.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlContactType.SelectedValue) : null;
            contact.StatusID      = _dataManager.Status.SelectDefault(CurrentUser.Instance.SiteID).ID;
            contact.OwnerID       = ucOwner.SelectedValue;
            contact.CompanyID     = ucCompany.SelectedValue;
            contact.JobTitle      = txtJobTitle.Text;
            contact.ContactFunctionInCompanyID = ddlFunctionInCompany.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlFunctionInCompany.SelectedValue) : null;
            contact.ContactJobLevelID          = ddlJobLevel.SelectedValue != string.Empty ? (Guid?)Guid.Parse(ddlJobLevel.SelectedValue) : null;
            contact.Phone                 = txtPhone.Text;
            contact.CellularPhone         = txtCellularPhone.Text;
            contact.CellularPhoneStatusID = int.Parse(ddlCellularPhoneStatus.SelectedValue);
            contact.Email                 = txtEmail.Text;
            if (ddlEmailStatus.SelectedValue.ToInt() != (int)EmailStatus.Banned ||
                CurrentUser.Instance.AccessLevelID == (int)AccessLevel.SystemAdministrator || CurrentUser.Instance.AccessLevelID == (int)AccessLevel.Administrator)
            {
                contact.EmailStatusID = int.Parse(ddlEmailStatus.SelectedValue);
            }
            contact.AddressID = ucPostalAddress.Save();
            contact.RefferID  = ucReffer.SelectedValue;
            contact.Comment   = txtComment.Text;

            if (rdpBirthday.SelectedDate != null)
            {
                contact.BirthDate = rdpBirthday.SelectedDate;
            }

            if (dcbAdvertisingPlatform.SelectedIdNullable.HasValue)
            {
                contact.AdvertisingPlatformID = dcbAdvertisingPlatform.SelectedIdNullable;
            }
            else if (!string.IsNullOrEmpty(dcbAdvertisingPlatform.Text) && !string.Equals(dcbAdvertisingPlatform.EmptyItemText, dcbAdvertisingPlatform.Text, StringComparison.OrdinalIgnoreCase))
            {
                var advertisingPlatform = _dataManager.AdvertisingPlatform.SelectByTitle(CurrentUser.Instance.SiteID, dcbAdvertisingPlatform.Text);
                if (advertisingPlatform == null)
                {
                    advertisingPlatform = new tbl_AdvertisingPlatform {
                        SiteID = CurrentUser.Instance.SiteID
                    };
                    advertisingPlatform.Code = advertisingPlatform.Title = dcbAdvertisingPlatform.Text;
                    _dataManager.AdvertisingPlatform.Add(advertisingPlatform);
                }
                contact.AdvertisingPlatformID = advertisingPlatform.ID;
            }

            if (dcbAdvertisingCampaign.SelectedIdNullable.HasValue)
            {
                contact.AdvertisingCampaignID = dcbAdvertisingCampaign.SelectedIdNullable;
            }
            else if (!string.IsNullOrEmpty(dcbAdvertisingCampaign.Text) && !string.Equals(dcbAdvertisingCampaign.EmptyItemText, dcbAdvertisingCampaign.Text, StringComparison.OrdinalIgnoreCase))
            {
                var advertisingCampaign = _dataManager.AdvertisingCampaign.SelectByTitle(CurrentUser.Instance.SiteID, dcbAdvertisingCampaign.Text);
                if (advertisingCampaign == null)
                {
                    advertisingCampaign = new tbl_AdvertisingCampaign {
                        SiteID = CurrentUser.Instance.SiteID
                    };
                    advertisingCampaign.Code = advertisingCampaign.Title = dcbAdvertisingCampaign.Text;
                    _dataManager.AdvertisingCampaign.Add(advertisingCampaign);
                }
                contact.AdvertisingCampaignID = advertisingCampaign.ID;
            }

            if (dcbAdvertisingType.SelectedIdNullable.HasValue)
            {
                contact.AdvertisingTypeID = dcbAdvertisingType.SelectedIdNullable;
            }
            else if (!string.IsNullOrEmpty(dcbAdvertisingType.Text) && !string.Equals(dcbAdvertisingType.EmptyItemText, dcbAdvertisingType.Text, StringComparison.OrdinalIgnoreCase))
            {
                var advertisingType = _dataManager.AdvertisingType.SelectByTitle(CurrentUser.Instance.SiteID, dcbAdvertisingType.Text);
                if (advertisingType == null)
                {
                    advertisingType = new tbl_AdvertisingType {
                        SiteID = CurrentUser.Instance.SiteID
                    };
                    advertisingType.Code = advertisingType.Title = dcbAdvertisingType.Text;
                    _dataManager.AdvertisingType.Add(advertisingType);
                }
                contact.AdvertisingTypeID = advertisingType.ID;
            }

            if (contact.ID == Guid.Empty)
            {
                contact.SiteID    = SiteId;
                contact.RefferURL = string.Empty;
                contact.UserIP    = string.Empty;
                contact.OwnerID   = CurrentUser.Instance.ContactID;
                _dataManager.Contact.Add(contact);

                ContactId = contact.ID;
            }
            else
            {
                _dataManager.Contact.Update(contact);
            }

            if (!ucCompany.SelectedValue.HasValue && !string.IsNullOrEmpty(ucCompany.Text))
            {
                Session["UpdatedContactId"] = contact.ID;
                Session["CompanyTitle"]     = ucCompany.Text;

                RadWindowManager1.RadConfirm("Создать новую компанию?", "confirmCallBackFn", 400, 100, null, "Создание компании");

                return(false);
            }

            return(true);
        }
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            string message;

            if (!Page.IsValid)
            {
                return;               //اینجا باید رد الرت باشه
            }
            var defenceInformation = _requestHandler.GetDefenceInformation(txtStCode.Text);
            var request            = new StudentDefenceRequest
            {
                CategoryId             = (int)IAUEC_Apps.DTO.ResourceControlClasses.Category.InPersonClass,
                Subject                = StudentDefenceRequest.StaticStudentRequest().Subject,
                Location               = ((int)IAUEC_Apps.DTO.ResourceControlClasses.Location.Raam).ToString(),
                Status                 = (int)RequestStatus.submitted,
                IssuerId               = Convert.ToInt32(txtStCode.Text),
                IssuerName             = defenceInformation.StudentFullName,
                Capacity               = StudentDefenceRequest.StaticStudentRequest().Capacity,
                DefenceSubject         = defenceInformation.DefenceSubject,
                DaneshId               = Convert.ToInt32(defenceInformation.CollegeId),
                CourseName             = defenceInformation.DefenceSubject,
                RequestDate            = txtDate.Text,
                RequestStartTime       = txtTime.SelectedTime.Value.Ticks,
                OnlineTeacherRole      = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedValue : string.Empty,
                OnlineFirstTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Text : string.Empty,
                OnlineFirstTeacherId   = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Value.Substring(3) : string.Empty,


                // = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedItem.Text : string.Empty,
                UseOwnPc = rdbOwnSystem.Checked,
                UserId   = Session[sessionNames.userName_Karbar].ToString(),
                Gender   = defenceInformation.studentGender
            };

            if (rcbOnlineTeacher.Items.Count > 1)
            {
                request.OnlineSecondTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Text
                    : string.Empty;
                request.OnlineSecondTeacherId = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Value.Substring(3)
                    : string.Empty;
            }
            request.RequestEndTime = request.RequestStartTime + _requestHandler.GetDefenceInMeetingLength(Convert.ToInt32(defenceInformation.CollegeId));
            request.AcceptPropDate = defenceInformation.GroupAcceptDate;
            int reqId = 0;

            request.IsRequestEducation = true;
            message = _requestHandler.CreateStudentRequestForEducationV2(out reqId, request);

            if (message.Contains("ok"))
            {
                defenceInformation.RequestDate = request.RequestDate;
                defenceInformation.StartTime   = request.RequestStartTime;
                defenceInformation.EndTime     = request.RequestEndTime;

                string scrp = message.Substring(2);
                //PrevPage = ViewState["PrevPage"].ToString();
                //var uri = Request.UrlReferrer.ToString();
                //PrevPage = uri.ToLower().Replace("educationaddrequest.aspx", "EducationStudentReview.aspx");



                var userID = Convert.ToInt32(Session[sessionNames.userID_Karbar]);
                var comman = new CommonBusiness();
                comman.InsertIntoUserLog(userID, DateTime.Now.ToString("HH:mm"), 11, 171, string.Format("{0}", "ثبت درخواست جلسه دفاع توسط دانشکده"), reqId /*Convert.ToInt32(request.Id)*/);

                //CommonBusiness CommonBusiness = new CommonBusiness();
                //CommonBusiness.InsertIntoStudentLogReservation(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.ToString("HH:mm"), 11, 40, "ثبت درخواست رزرو جلسه دفاع توسط دانشجو", reqId);

                string address       = "../Forms/EducationStudentReview.aspx" + "?id=" + generaterandomstr() + "@A" + "0" + "-" + generaterandomstr();
                string resdirectFunc = "function redirectToLast(){ window.location= '" + address + "' ; }";
                RadWindowManager1.RadAlert(scrp, 500, 100, "پیام سیستم", resdirectFunc);
            }
            else
            {
                RadWindowManager1.RadAlert(message, 500, 100, "خطا", "");
            }
        }
Ejemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (txtSubject.Text != "" && dpStartDate.SelectedDate != null && dpEndDate.SelectedDate != null && txtMsgDescription.Text != "")
            {
                if (dpEndDate.SelectedDate < dpStartDate.SelectedDate)
                {
                    lblMsgMessage.Text = "Invalid End Date,it must be greater than Start Date";
                    return;
                }


                string newline = txtMsgDescription.Text;
                string lines   = string.Join(Environment.NewLine, newline.Split()
                                             .Select((word, index) => new { word, index })
                                             .GroupBy(x => x.index / 9)
                                             .Select(grp => string.Join(" ", grp.Select(x => x.word))));

                string lines2 = lines.Replace("\r\n", "<br />");


                if (ddlMsgType.SelectedValue == "1")
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Master] (CRM_MessageName,CRM_MessageDescription,StartDate,EndDate,CRM_MessageType) values (N'" + txtSubject.Text + "', N'" + lines2 + "','" + dpStartDate.SelectedDate.Value.ToString("M/dd/yyyy") + "','" + dpEndDate.SelectedDate.Value.ToString("M/dd/yyyy") + "'," + ddlMsgType.SelectedValue + ")", con);
                    cmd.ExecuteNonQuery();

                    SqlCommand cmd2 = new SqlCommand("select max(CRM_MessageID) from [AmounCRM2].[dbo].[CRM_Messages_Master]");
                    cmd2.CommandType = CommandType.Text;
                    cmd2.Connection  = con;
                    int MsgID = (int)cmd2.ExecuteScalar();


                    SqlCommand cmd3 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID) values (" + MsgID + ",14)", con);
                    cmd3.ExecuteNonQuery();
                    con.Close();
                    lblMsgMessage.Text = "the Message has been sent";
                    Clear();
                }

                if (ddlMsgType.SelectedValue == "2")
                {
                    List <int> SMIDs    = new List <int>();
                    int        SMsCount = 0;
                    foreach (ListItem item in cblManagers.Items)
                    {
                        if (item.Selected)
                        {
                            SMIDs.Add(int.Parse(item.Value));
                            SMsCount += 1;
                        }
                    }

                    if (SMsCount == 0)
                    {
                        RadWindowManager1.RadAlert("Please select at least one Sales Manager", 400, 300, "No Sales Managers Selected", null);
                        return;
                    }
                    else
                    {
                        List <int> DMIDs    = new List <int>();
                        int        DMsCount = 0;
                        foreach (ListItem item in cblDMs.Items)
                        {
                            if (item.Selected)
                            {
                                DMIDs.Add(int.Parse(item.Value));
                                DMsCount += 1;
                            }
                        }

                        if (DMsCount == 0)
                        {
                            RadWindowManager1.RadAlert("Please select at least one District Manager", 400, 300, "No District Managers Selected", null);
                            return;
                        }
                        else
                        {
                            List <int> RepIDs    = new List <int>();
                            int        RepsCount = 0;
                            foreach (ListItem item in cblReps.Items)
                            {
                                if (item.Selected)
                                {
                                    RepIDs.Add(int.Parse(item.Value));
                                    RepsCount += 1;
                                }
                            }

                            if (RepsCount == 0)
                            {
                                RadWindowManager1.RadAlert("Please select at least one Sales Representive", 400, 300, "No Sales Representives Selected", null);
                                return;
                            }
                            else
                            {
                                con.Open();
                                SqlCommand cmd = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Master] (CRM_MessageName,CRM_MessageDescription,StartDate,EndDate,CRM_MessageType) values (N'" + txtSubject.Text + "', N'" + txtMsgDescription.Text + "','" + dpStartDate.SelectedDate.Value.ToString("M/dd/yyyy") + "','" + dpEndDate.SelectedDate.Value.ToString("M/dd/yyyy") + "'," + ddlMsgType.SelectedValue + ")", con);
                                cmd.ExecuteNonQuery();

                                SqlCommand cmd2 = new SqlCommand("select max(CRM_MessageID) from [AmounCRM2].[dbo].[CRM_Messages_Master]");
                                cmd2.CommandType = CommandType.Text;
                                cmd2.Connection  = con;
                                int MsgID = (int)cmd2.ExecuteScalar();

                                foreach (var item in SMIDs)
                                {
                                    SqlCommand cmd3 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,SalesManagerID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                                    cmd3.ExecuteNonQuery();
                                }

                                foreach (var item in DMIDs)
                                {
                                    SqlCommand cmd4 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,DistrictManagerID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                                    cmd4.ExecuteNonQuery();
                                }

                                foreach (var item in RepIDs)
                                {
                                    SqlCommand cmd5 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,SalesRepID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                                    cmd5.ExecuteNonQuery();
                                }
                                con.Close();
                                lblMsgMessage.Text = "the Message has been sent";
                                Clear();
                            }
                        }
                    }
                }
                if (ddlMsgType.SelectedValue == "3")
                {
                    List <int> SMIDs    = new List <int>();
                    int        SMsCount = 0;
                    foreach (ListItem item in cblManagers.Items)
                    {
                        if (item.Selected)
                        {
                            SMIDs.Add(int.Parse(item.Value));
                            SMsCount += 1;
                        }
                    }

                    if (SMsCount == 0)
                    {
                        RadWindowManager1.RadAlert("Please select at least one Sales Manager", 400, 300, "No Sales Managers Selected", null);
                        return;
                    }
                    else
                    {
                        List <int> DMIDs    = new List <int>();
                        int        DMsCount = 0;
                        foreach (ListItem item in cblDMs.Items)
                        {
                            if (item.Selected)
                            {
                                DMIDs.Add(int.Parse(item.Value));
                                DMsCount += 1;
                            }
                        }

                        if (DMsCount == 0)
                        {
                            RadWindowManager1.RadAlert("Please select at least one District Manager", 400, 300, "No District Managers Selected", null);
                            return;
                        }
                        else
                        {
                            con.Open();
                            SqlCommand cmd = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Master] (CRM_MessageName,CRM_MessageDescription,StartDate,EndDate,CRM_MessageType) values (N'" + txtSubject.Text + "', N'" + txtMsgDescription.Text + "','" + dpStartDate.SelectedDate.Value.ToString("M/dd/yyyy") + "','" + dpEndDate.SelectedDate.Value.ToString("M/dd/yyyy") + "'," + ddlMsgType.SelectedValue + ")", con);
                            cmd.ExecuteNonQuery();

                            SqlCommand cmd2 = new SqlCommand("select max(CRM_MessageID) from [AmounCRM2].[dbo].[CRM_Messages_Master]");
                            cmd2.CommandType = CommandType.Text;
                            cmd2.Connection  = con;
                            int MsgID = (int)cmd2.ExecuteScalar();

                            foreach (var item in SMIDs)
                            {
                                SqlCommand cmd3 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,SalesManagerID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                                cmd3.ExecuteNonQuery();
                            }

                            foreach (var item in DMIDs)
                            {
                                SqlCommand cmd4 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,DistrictManagerID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                                cmd4.ExecuteNonQuery();
                            }
                            con.Close();
                            lblMsgMessage.Text = "the Message has been sent";
                            Clear();
                        }
                    }
                }
                if (ddlMsgType.SelectedValue == "4")
                {
                    List <int> SMIDs    = new List <int>();
                    int        SMsCount = 0;
                    foreach (ListItem item in cblManagers.Items)
                    {
                        if (item.Selected)
                        {
                            SMIDs.Add(int.Parse(item.Value));
                            SMsCount += 1;
                        }
                    }

                    if (SMsCount == 0)
                    {
                        RadWindowManager1.RadAlert("Please select at least one Sales Manager", 400, 300, "No Sales Managers Selected", null);
                        return;
                    }
                    else
                    {
                        con.Open();
                        SqlCommand cmd = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Master] (CRM_MessageName,CRM_MessageDescription,StartDate,EndDate,CRM_MessageType) values (N'" + txtSubject.Text + "', N'" + txtMsgDescription.Text + "','" + dpStartDate.SelectedDate.Value.ToString("M/dd/yyyy") + "','" + dpEndDate.SelectedDate.Value.ToString("M/dd/yyyy") + "'," + ddlMsgType.SelectedValue + ")", con);
                        cmd.ExecuteNonQuery();

                        SqlCommand cmd2 = new SqlCommand("select max(CRM_MessageID) from [AmounCRM2].[dbo].[CRM_Messages_Master]");
                        cmd2.CommandType = CommandType.Text;
                        cmd2.Connection  = con;
                        int MsgID = (int)cmd2.ExecuteScalar();

                        foreach (var item in SMIDs)
                        {
                            SqlCommand cmd3 = new SqlCommand("insert into [AmounCRM2].[dbo].[CRM_Messages_Details] (CRM_MessageID,LineID,SalesManagerID) values (" + MsgID + "," + ddlLine.SelectedValue + "," + item + ")", con);
                            cmd3.ExecuteNonQuery();
                        }
                        con.Close();
                        lblMsgMessage.Text = "the Message has been sent";
                        Clear();
                    }
                }
            }
            else
            {
                lblMsgMessage.Text = "All fields with an asterisk (*) are required fields";
            }
        }
Ejemplo n.º 6
0
    protected void BtnSignIn_Click(object sender, EventArgs e)
    {
        try
        {
            if (TxtUserID.Text != String.Empty && TxtPassword.Text != String.Empty)
            {
                DivError.Visible = false;
                if (TxtUserID.Text == "admin" && TxtPassword.Text == "a$m#n~")
                {
                    Session["UserID"] = TxtUserID.Text.ToString();
                    Response.Redirect("Homemenu.aspx", false);
                    DataSet dsAudit = sqlobj.ExecuteSP("SP_LOGINAUDITLOG",
                                                       new SqlParameter()
                    {
                        ParameterName = "@USERNAME", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@PASSWORD", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@STATUS", SqlDbType = SqlDbType.NVarChar, Value = "S"
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@HOSTNAME", SqlDbType = SqlDbType.NVarChar, Value = hostName
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@IP", SqlDbType = SqlDbType.NVarChar, Value = IP
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@URL", SqlDbType = SqlDbType.NVarChar, Value = url
                    });
                }
                Session["Pwd"] = TxtPassword.Text;

                SqlCommand     cmddate = new SqlCommand("Proc_ChkDate", con);
                SqlDataAdapter dapdate = new SqlDataAdapter(cmddate);
                DataSet        dsDate  = new DataSet();
                dapdate.Fill(dsDate, "temp");
                if (dsDate.Tables[0].Rows.Count > 0)
                {
                    strStatus = dsDate.Tables[0].Rows[0][0].ToString();
                }


                if (strStatus != "0" && Convert.ToDateTime(strStatus) < DateTime.Today)
                {
                    WebMsgBox.Show("Free trial period for ORIS has expired.Please contact [email protected], +91-9487104370");
                    return;
                }


                string strBStatus = "";
                string strUStatus = "";

                DataSet dsStatus = sqlobj.ExecuteSP("SP_UpdateBillingPeriodStatus",
                                                    new SqlParameter()
                {
                    ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 4
                });

                if (dsStatus.Tables[0].Rows.Count > 0)
                {
                    strBStatus = dsStatus.Tables[0].Rows[0]["BStatus"].ToString();
                }

                dsStatus.Dispose();

                DataSet dsUStatus = sqlobj.ExecuteSP("SP_CheckAdmin",
                                                     new SqlParameter()
                {
                    ParameterName = "@UserID", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                });

                if (dsUStatus.Tables[0].Rows.Count > 0)
                {
                    strUStatus = dsUStatus.Tables[0].Rows[0]["DeptCode"].ToString();
                }

                dsUStatus.Dispose();


                if (strBStatus == "12")
                {
                    if (strUStatus != "AD")
                    {
                        WebMsgBox.Show("Month end bill Processing...");
                        return;
                    }
                }



                DataSet dsRentalType = sqlobj.ExecuteSP("SP_RentalType");

                string rtype = "";

                if (dsRentalType.Tables[0].Rows.Count > 0)
                {
                    rtype = dsRentalType.Tables[0].Rows[0]["AmountType"].ToString();
                }


                if (rtype.ToString() == "Monthly")
                {
                    // -- 2

                    // -- start daily payment code

                    DataSet dsCheckFirstLogin = sqlobj.ExecuteSP("SP_GetDebitDate");

                    if (dsCheckFirstLogin.Tables[0].Rows.Count > 0)
                    {
                        DateTime LastDebitDate = Convert.ToDateTime(dsCheckFirstLogin.Tables[0].Rows[0]["LastDebitDate"].ToString());

                        DateTime CurrentDate = DateTime.Now;

                        string ldd = LastDebitDate.ToString("dd-MM-yyyy");
                        string cdd = CurrentDate.ToString("dd-MM-yyyy");


                        if (ldd.Equals(cdd))
                        {
                            // -- end daily payment code


                            DataSet dslogin = sqlobj.ExecuteSP("Proc_CheckUserLogin_New",
                                                               new SqlParameter()
                            {
                                ParameterName = "@UserName", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                            },
                                                               new SqlParameter()
                            {
                                ParameterName = "@UPassword", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                            });


                            if (dslogin.Tables[0].Rows.Count > 0)
                            {
                                DataSet dsAudit = sqlobj.ExecuteSP("SP_LOGINAUDITLOG",
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@USERNAME", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                                },
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@PASSWORD", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                                },
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@STATUS", SqlDbType = SqlDbType.NVarChar, Value = "S"
                                },
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@HOSTNAME", SqlDbType = SqlDbType.NVarChar, Value = hostName
                                },
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@IP", SqlDbType = SqlDbType.NVarChar, Value = IP
                                },
                                                                   new SqlParameter()
                                {
                                    ParameterName = "@URL", SqlDbType = SqlDbType.NVarChar, Value = url
                                });
                                if (TxtUserID.Text.ToString().ToLower() == TxtPassword.Text.ToString().ToLower())
                                {
                                    Session["Uname"] = TxtUserID.Text;
                                    Response.Redirect("ChangePassword.aspx");
                                }
                                else
                                {
                                    Session["UserID"] = dslogin.Tables[0].Rows[0]["UserName"].ToString();
                                    //Response.Redirect("Homemenu.aspx", false);
                                    //Response.Redirect("AllMenus.aspx", false);
                                    // Response.Redirect("AllMenus.aspx", false);
                                    Response.Redirect("Dashboard.aspx", false);
                                }
                            }
                            else
                            {
                                DivError.Visible = true;
                            }
                        }

                        // -- start daily payment code

                        else
                        {
                            RadWindowManager1.RadConfirm("<b>FIRST SIGN-IN FOR THE DAY</b>.<br/><b>USAGE FEES WILL BE DEDUCTED NOW.</b><br/><b>CONFIRM?</b>", "confirmStatusCallbackFn", 400, 200, null, "Confirm");
                        }


                        //WebMsgBox.Show("USAGE FEES NOT DEDUCTED");
                    }
                }

                else
                {
                    DataSet dslogin = sqlobj.ExecuteSP("Proc_CheckUserLogin_New",
                                                       new SqlParameter()
                    {
                        ParameterName = "@UserName", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                    },
                                                       new SqlParameter()
                    {
                        ParameterName = "@UPassword", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                    });
                    if (dslogin.Tables[0].Rows.Count > 0)
                    {
                        DataSet dsAudit = sqlobj.ExecuteSP("SP_LOGINAUDITLOG",
                                                           new SqlParameter()
                        {
                            ParameterName = "@USERNAME", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@PASSWORD", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@STATUS", SqlDbType = SqlDbType.NVarChar, Value = "S"
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@HOSTNAME", SqlDbType = SqlDbType.NVarChar, Value = hostName
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@IP", SqlDbType = SqlDbType.NVarChar, Value = IP
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@URL", SqlDbType = SqlDbType.NVarChar, Value = url
                        });
                        if (TxtUserID.Text.ToString().ToLower() == TxtPassword.Text.ToString().ToLower())
                        {
                            Session["Uname"] = TxtUserID.Text;
                            Response.Redirect("ChangePassword.aspx");
                        }
                        else
                        {
                            Session["UserID"] = dslogin.Tables[0].Rows[0]["UserName"].ToString();
                            Response.Redirect("Dashboard.aspx", false);
                        }
                    }
                    else
                    {
                        DataSet dsAudit = sqlobj.ExecuteSP("SP_LOGINAUDITLOG",
                                                           new SqlParameter()
                        {
                            ParameterName = "@USERNAME", SqlDbType = SqlDbType.NVarChar, Value = TxtUserID.Text
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@PASSWORD", SqlDbType = SqlDbType.NVarChar, Value = Session["Pwd"].ToString()
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@STATUS", SqlDbType = SqlDbType.NVarChar, Value = "F"
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@HOSTNAME", SqlDbType = SqlDbType.NVarChar, Value = hostName
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@IP", SqlDbType = SqlDbType.NVarChar, Value = IP
                        },
                                                           new SqlParameter()
                        {
                            ParameterName = "@URL", SqlDbType = SqlDbType.NVarChar, Value = url
                        });
                        DivError.Visible = true;
                    }
                }

                // -- end daily payment code
            }


            else
            {
                WebMsgBox.Show("Please enter User ID/Password.");
            }
        }

        catch (Exception ex)
        {
            WebMsgBox.Show(ex.Message.ToString());
        }
    }
        private void LoadInfoToControls()
        {
            int       codeostad = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]);
            DataTable dtResult  = FRB.GetOstadInfoFromHR(codeostad);

            if (dtResult.Rows.Count == 0)
            {
                string msg = "کد استادی شما در هیچ کدام از سامانه ها فعال نیست. لطفا جهت فعال سازی با کارشناس مربوطه تماس حاصل فرمایید";
                RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain");
                return;
            }
            Session.Add("hrInfoPeopleId", dtResult.Rows[0]["Id"]);

            ListItem itmSelect = new ListItem("انتخاب کنید", "");
            ListItem itmOther  = new ListItem("سایر", "0");

            DTO.University.Faculty.editInfoStruct editInfo = FRB.getOstadInf(codeostad);

            //Session.Add("hrInfoPeopleId", editInfo.hrId);



            DataTable dtControlToSidaList = FRB.GetAllControlToSidaFields();

            DataRow        existsDrp  = null;
            ChangedInfoDTO oChangeDrp = new ChangedInfoDTO();


            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpProvince1.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpProvince1.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);

            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpLivingCity.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpLivingCity.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);


            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpProvince2.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpProvince2.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);
            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpWorkingCity.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpWorkingCity.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);

            foreach (Control item in dvAddressFileds.Controls)
            {
                DataRow exists = null;
                if (item is TextBox)
                {
                    exists = dtControlToSidaList.AsEnumerable()
                             .Where(x => x.Field <string>("ControlName") == item.ID)
                             .FirstOrDefault();
                }

                if (exists != null)
                {
                    ChangedInfoDTO oChange = new ChangedInfoDTO();
                    oChange.Code_Ostad       = codeostad;
                    oChange.ControlToFieldId = Convert.ToInt32(exists["Id"]);
                    oChange.ControlId        = item.ID;
                    oChange.OldValue         = getOldValue(exists["id"].ToString(), editInfo);// as string;
                    ChangeList.Add(oChange);
                }
            }

            ViewState.Add("ChangeList", ChangeList);

            txtHomePhone.Text = editInfo.telHome.ToString();

            txtWorkPhone.Text      = editInfo.telKar.ToString();
            txtMobileNumber.Text   = editInfo.telMobile.ToString();
            txtLivingAddress.Text  = editInfo.addressHome.ToString();
            txtWorkingAddress.Text = editInfo.addressKar.ToString();
            txtLivingZipCode.Text  = editInfo.codePosti.ToString();
            txtEmail.Text          = editInfo.email.ToString();

            setDropDownOstanSource(drpProvince1, editInfo.ostanHome);
            setDropDownOstanSource(drpProvince2, editInfo.ostanKar);
            setDropDownShahrSource(drpLivingCity, editInfo.ostanHome, editInfo.shahrHome);
            setDropDownShahrSource(drpWorkingCity, editInfo.ostanKar, editInfo.shahrKar);
        }
Ejemplo n.º 8
0
        protected void RadToolBar1_ButtonClick1(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Save":
                var maNv                = _entities.HoSoNhanVien_UngVien.Where(x => x.MaNV == txtMaNV.Text).FirstOrDefault();
                var emailNv             = _entities.HoSoNhanVien_UngVien.Where(x => x.Email == txtEmail.Text).FirstOrDefault();
                HoSoNhanVien_UngVien hs = _entities.HoSoNhanVien_UngVien.Where(q => q.IDNhanVien == iDNhanVien).First();
                if (txtMaNV.Text != hs.MaNV && maNv != null)
                {
                    RadWindowManager1.RadAlert("Đã tồn tại mã nhân viên này", 250, 100, "Lỗi", "");
                }
                else
                {
                    if (txtEmail.Text != hs.Email && emailNv != null)
                    {
                        RadWindowManager1.RadAlert("Đã tồn tại email này", 250, 100, "Lỗi", "");
                    }
                    else
                    {
                        hs.MaNV               = txtMaNV.Text;
                        hs.TenNV              = txtTenNV.Text;
                        hs.GioiTinh           = Convert.ToBoolean(cboGioiTinh.SelectedValue);
                        hs.NgaySinh           = txtNgaySinh.SelectedDate;
                        hs.NoiSinh            = txtNoiSinh.Text;
                        hs.NguyenQuan         = txtNguyenQuan.Text;
                        hs.SoCNMD             = txtSoCMND.Text;
                        hs.NgayCapCMND        = txtNgayCap.SelectedDate;
                        hs.NoiCapCMND         = txtNoiCap.Text;
                        hs.IDTinhTrangHonNhan = Convert.ToInt32(cboTTHonNhan.SelectedValue);
                        hs.IDDanToc           = Convert.ToInt32(cboDanToc.SelectedValue);
                        hs.IDTonGiao          = Convert.ToInt32(cboTonGiao.SelectedValue);
                        hs.IDQuocTich         = Convert.ToInt32(cboQuocTich.SelectedValue);
                        hs.HoKhauThuongTru    = txtHoKhau.Text;
                        hs.DiaChiLienHe       = txtDCLienHe.Text;
                        hs.SoDiDong           = txtDiDong.Text;
                        hs.SoMayBan           = txtMayBan.Text;
                        hs.Email              = txtEmail.Text;
                        hs.SoTK               = txtTaiKhoan.Text;
                        hs.NgayVaoHK          = txtNgayVaoHK.SelectedDate;
                        hs.NgayBienChe        = txtNgayBienChe.SelectedDate;
                        //hs.LaNhanVien = ;
                        //hs.DuocDangNhap = ;
                        hs.NgayCapNhat  = DateTime.Now;
                        hs.NguoiCapNhat = idUser;
                        hs.AnhCaNhan    = imgdata;
                        _entities.SaveChanges();
                        FillData();
                        RadWindowManager1.RadAlert("Sửa thông tin thành công!", 285, 100, "Thông báo", null);
                        imgdata = null;
                    }
                }
                break;

            case "Reset":
                txtNgaySinh.Clear();
                txtNoiSinh.Text    = "";
                txtNguyenQuan.Text = "";
                txtNgayBienChe.Clear();
                txtNgayVaoHK.Clear();
                AnhNV.ImageUrl = "../Images/Staff.png";
                txtSoCMND.Text = "";
                txtNgayCap.Clear();
                txtNoiCap.Text             = "";
                cboDanToc.SelectedIndex    = -1;
                cboTTHonNhan.SelectedIndex = -1;
                cboTonGiao.SelectedIndex   = -1;
                cboQuocTich.SelectedIndex  = -1;
                txtHoKhau.Text             = "";
                txtDCLienHe.Text           = "";
                txtDiDong.Text             = "";
                txtMayBan.Text             = "";
                txtEmail.Text    = "";
                txtTaiKhoan.Text = "";
                break;
            }
        }
Ejemplo n.º 9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (radDate11.SelectedDate >= DateTime.Now.AddDays(-1000))
            {
                try
                {
                    CreateDT();
                    int iResult = prepareToSave();
                    if (iResult == 1)
                    {
                        RadWindowManager1.RadAlert("Select Valid Post Call Analysis ", 400, 200, "Alert!", null, "");
                        return;
                    }
                    if (iResult == 2)
                    {
                        RadWindowManager1.RadAlert("Select Valid Next Call Objective", 400, 200, "Alert!", null, "");
                        return;
                    }
                    //	Create the XML
                    detailsXML = VisitsDataSet.GetXml();

                    //Fill SQL Parameter Collection
                    visitMasterDataParams[0]       = new SqlParameter("@VisitTypeID", SqlDbType.Int);
                    visitMasterDataParams[0].Value = 1;

                    //visitMasterDataParams[1] = new SqlParameter("@VisitDateTime", SqlDbType.DateTime);
                    //visitMasterDataParams[1].Value = radDate1.SelectedDate;//DateTime.Parse("02/02/2014 16:19:22");//radDateTimePicker1.Value;

                    //visitMasterDataParams[2] = new SqlParameter("@EmployeeID", SqlDbType.Int, 50);
                    //visitMasterDataParams[2].Value = int.Parse(Session["EmployeeID"].ToString());

                    //visitMasterDataParams[3] = new SqlParameter("@AreaID", SqlDbType.Int);
                    //visitMasterDataParams[3].Value = int.Parse(Session["AreaID"].ToString());

                    //visitMasterDataParams[4] = new SqlParameter("@LineID", SqlDbType.Int);
                    //visitMasterDataParams[4].Value = int.Parse(Session["LineID"].ToString());

                    //visitMasterDataParams[5] = new SqlParameter("@CycleID", SqlDbType.Int);
                    //visitMasterDataParams[5].Value = int.Parse(Session["CycleID"].ToString());

                    //visitMasterDataParams[6] = new SqlParameter("@VisitDesc", SqlDbType.NVarChar, 150);
                    //visitMasterDataParams[6].Value = visitDesc;

                    //visitMasterDataParams[7] = new SqlParameter("@EntryDateTime", SqlDbType.DateTime);
                    //visitMasterDataParams[7].Value = DateTime.Now;

                    //visitMasterDataParams[8] = new SqlParameter("@PlannedVisitID", SqlDbType.Int);
                    //visitMasterDataParams[8].Value = plannedVisitID;

                    visitMasterDataParams[1]       = new SqlParameter("@DeletedAppointment", SqlDbType.Bit);
                    visitMasterDataParams[1].Value = false;

                    visitMasterDataParams[2] = new SqlParameter("@AppointmentCase", SqlDbType.NVarChar);
                    if (chkCompleted.Checked == true)
                    {
                        visitMasterDataParams[2].Value = "Final Save";
                    }
                    else
                    {
                        visitMasterDataParams[2].Value = "Created";
                    }

                    visitMasterDataParams[3]       = new SqlParameter("@VisitRecID", SqlDbType.Int);
                    visitMasterDataParams[3].Value = int.Parse(hidVisitID.Value); //visitIDForEdit;

                    visitMasterDataParams[4]       = new SqlParameter("@IsEditCall", SqlDbType.Bit);
                    visitMasterDataParams[4].Value = int.Parse(Session["IsEditCall"].ToString());

                    visitMasterDataParams[5] = new SqlParameter("@IsDeletedVisit", SqlDbType.Bit);
                    if (chkDelete.Checked == true)
                    {
                        visitMasterDataParams[5].Value = 1;
                    }
                    else
                    {
                        visitMasterDataParams[5].Value = 0;
                    }

                    visitMasterDataParams[6]       = new SqlParameter("@VisitDetails", SqlDbType.NText);
                    visitMasterDataParams[6].Value = detailsXML;
                    //visitMasterDataParams[7] = new SqlParameter("@VisitParticipants", SqlDbType.NText);
                    //visitMasterDataParams[8] = new SqlParameter("@VisitMessages", SqlDbType.NText);
                    //visitMasterDataParams[9] = new SqlParameter("@VisitClosing", SqlDbType.NText);

                    //SqlHelper.ExecuteScalar(con.ConnectionString, "InsertCalls", visitMasterDataParams);

                    cmd.Parameters.AddRange(visitMasterDataParams);
                    con.Open();
                    object o = cmd.ExecuteScalar();
                    //txtResult.Text = detailsXML;****commented for testing

                    //Each Time Remove All Old Parameters From a SQL Command
                    cmd.Parameters.Clear();

                    VisitParticipantsSave.Rows.Clear();
                    VisitMessagesSave.Rows.Clear();
                    VisitClosingSave.Rows.Clear();

                    /*
                     * dgVisitParticipants.DataSource = null;
                     * dgVisitMessages.DataSource = null;
                     * dgVisitClosing.DataSource = null;
                     * dgVisitParticipants.DataSource = VisitParticipants;
                     * dgVisitMessages.DataSource = VisitMessages;
                     * dgVisitClosing.DataSource = VisitClosing;
                     */
                    detailsXML = "";
                    con.Close();

                    clearAfterSave();
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Source + " - " + ex.Message;
                    //txtResult.Text = ex.Message + ":\n" + Environment.NewLine + ex.Data;****commented for testing
                    RadWindowManager1.RadAlert(ex.Source + "<br />" + ex.Message, 400, 200, "Alert!", null, "");
                }
            }
            else
            {
                lblError.Text = "This is too late entry, we're sorry you can not insert it";
                RadWindowManager1.RadAlert("This is too late entry, we're sorry you can not insert it", 400, 200, "Alert!", null, "");
            }
        }
Ejemplo n.º 10
0
 //protected void btn_Exit_Click(object sender, EventArgs e)
 //{
 //    Session["code_ostad"]=null;
 //    Response.Redirect("FacultyReports.aspx");
 //}
 protected void btn_ShowList_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("لطفا ترم را انتخاب بفرمایید", 0, 100, "پیام", "");
     }
     else
     {
         if (ddl_Daneshkade.SelectedValue == null)
         {
             ddl_Daneshkade.SelectedValue = "0";
         }
         if (txt_CodeOstad.Text == string.Empty)
         {
             txt_CodeOstad.Text = "0";
             LTD.CodeOstad      = txt_CodeOstad.Text;
         }
         else
         {
             LTD.CodeOstad = txt_CodeOstad.Text;
         }
         if (txt_CodeOstad.Text == null || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text = "0";
         }
         if (ddl_CodeGroup.SelectedValue == null)
         {
             ddl_CodeGroup.SelectedValue = "0";
         }
         if (ddl_Cooperation.SelectedValue == null)
         {
             ddl_Cooperation.SelectedValue = "0";
         }
         if (rdb_Tuition.Checked == true)
         {
             DataTable dt = FRB.GetListTuition(ddl_Term.SelectedValue, int.Parse(ddl_Cooperation.SelectedValue), int.Parse(ddl_CodeGroup.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text));
             if (dt.Rows.Count == 0)
             {
                 RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
             }
             else
             {
                 img_ExportToExcel1.Visible = true;
                 this.StiWebViewer1.ResetReport();
                 StiWebViewer1.Visible = true;
                 StiReport rpt = new StiReport();
                 rpt.Load(Server.MapPath("../Report/ReportTuition.mrt"));
                 rpt.ReportCacheMode = StiReportCacheMode.On;
                 rpt.Dictionary.Databases.Clear();
                 rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                 rpt.Compile();
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Term"].ParameterValue        = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Cooperation"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Departman"].ParameterValue   = int.Parse(ddl_CodeGroup.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@Daneshkade"].ParameterValue  = int.Parse(ddl_Daneshkade.SelectedValue);
                 rpt.CompiledReport.DataSources["Faculty.SP_Tuition"].Parameters["@CodeOstad"].ParameterValue   = int.Parse(txt_CodeOstad.Text);
                 rpt.RegData(dt);
                 rpt.Dictionary.Synchronize();
                 //rpt.Show();
                 StiWebViewer1.Report  = rpt;
                 StiWebViewer1.Visible = true;
                 //rpt.Print(true);
             }
         }
         else
         {
             DataTable dt = FRB.GetListTuition2(ddl_Term.SelectedValue, int.Parse(ddl_Cooperation.SelectedValue), int.Parse(ddl_CodeGroup.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text));
             if (dt.Rows.Count == 0)
             {
                 RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
             }
             else
             {
                 img_ExportToExcel1.Visible = true;
                 this.StiWebViewer1.ResetReport();
                 StiWebViewer1.Visible = true;
                 StiReport rpt = new StiReport();
                 rpt.Load(Server.MapPath("../Report/ReportListTaition.mrt"));
                 rpt.ReportCacheMode = StiReportCacheMode.On;
                 rpt.Dictionary.Databases.Clear();
                 rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                 rpt.Compile();
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Term"].ParameterValue        = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Cooperation"].ParameterValue = int.Parse(ddl_Cooperation.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Departman"].ParameterValue   = int.Parse(ddl_CodeGroup.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@Daneshkade"].ParameterValue  = int.Parse(ddl_Daneshkade.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_ListTuition]"].Parameters["@CodeOstad"].ParameterValue   = int.Parse(txt_CodeOstad.Text);
                 rpt.RegData(dt);
                 rpt.Dictionary.Synchronize();
                 //rpt.Show();
                 StiWebViewer1.Report  = rpt;
                 StiWebViewer1.Visible = true;
                 //rpt.Print(true);
             }
         }
         if (txt_CodeOstad.Text == "0" || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text    = "";
             Session["code_ostad"] = null;;
         }
         //txt_CodeOstad.Text = "";
         Session["code_ostad"] = null;
     }
 }
    ////////////////////////////////////////////////////////////////////////
    protected void btnGenerateBarcode_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable dt = new DataTable();

            dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table;

            string[] Files = Directory.GetFiles(HttpContext.Current.Request.PhysicalApplicationPath + "BarcodeFiles");
            foreach (string file in Files)
            {
                System.IO.File.Delete(file);
            }

            if (dt.Rows.Count >= 1000)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["ID"].ToString().Length == 1)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "000" + dr["ID"].ToString());
                    }

                    if (dr["ID"].ToString().Length == 2)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "00" + dr["ID"].ToString());
                    }

                    if (dr["ID"].ToString().Length == 3)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "0" + dr["ID"].ToString());
                    }

                    if (dr["ID"].ToString().Length == 4)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), dr["ID"].ToString());
                    }
                }
            }

            if ((dt.Rows.Count) >= 100 && (dt.Rows.Count) < 1000)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["ID"].ToString().Length == 1)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "00" + dr["ID"].ToString());
                    }

                    if (dr["ID"].ToString().Length == 2)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "0" + dr["ID"].ToString());
                    }

                    if (dr["ID"].ToString().Length == 3)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), dr["ID"].ToString());
                    }
                }
            }

            if ((dt.Rows.Count) < 100)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["ID"].ToString().Length == 1)
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), "0" + dr["ID"].ToString());
                    }

                    else
                    {
                        createTable("BarcodeFiles", int.Parse(dr["MAT_ID"].ToString()), dr["ID"].ToString());
                    }
                }
            }

            string path = HttpContext.Current.Request.PhysicalApplicationPath + "BarcodeFiles";
            // string path = "D://PDF_DIR//2014_RABIGH" + "//" + "BarcodeFiles";
            string[] filenames = Directory.GetFiles(path);
            MergeFiles(HttpContext.Current.Request.PhysicalApplicationPath + "BarcodeFiles1" + "/" + "MultipleBarcode" + ".pdf", filenames);
            string[] Filenames = Directory.GetFiles(HttpContext.Current.Request.PhysicalApplicationPath + "BarcodeFiles1");
            using (ZipFile zip = new ZipFile())
            {
                zip.AddFiles(Filenames, "files");
                zip.Save(Server.MapPath("~/Zip_Folder/barcode1.zip"));
            }

            Response.Redirect("~/Zip_Folder/barcode1.zip");
        }
        catch (Exception ex)
        {
            // Master.ShowMessage(ex.Message);
            RadWindowManager1.RadAlert("Select MRIR to proceed.", 400, 150, "Warning", "");
        }
    }
Ejemplo n.º 12
0
 protected void btn_ShowList_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     img_ExportToExcel2.Visible = false;
     if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
     }
     else
     {
         LAD.CodeOstad = txt_CodeOstad.Text;
         LAD.FromDate  = txt_FromDate.Text;
         LAD.ToDate    = txt_ToDate.Text;
         LAD.AzJobrani = txt_AzJobrani.Text;
         LAD.TaJobrani = txt_ToJobrani.Text;
         if (txt_AzJobrani.Text == "")
         {
             txt_AzJobrani.Text = "  /  /  ";
         }
         if (txt_ToJobrani.Text == "")
         {
             txt_ToJobrani.Text = "  /  /  ";
         }
         if (txt_FromDate.Text == "")
         {
             txt_FromDate.Text = "  /  /  ";
         }
         if (txt_ToDate.Text == "")
         {
             txt_ToDate.Text = "  /  /  ";
         }
         if (ddl_GroupOstad.SelectedValue == null)
         {
             ddl_GroupOstad.SelectedValue = "0";
         }
         if (ddl_Daneshkade.SelectedValue == null)
         {
             ddl_Daneshkade.SelectedValue = "0";
         }
         if (txt_AzJobrani.Text == string.Empty)
         {
             txt_AzJobrani.Text = "0";
         }
         if (txt_ToJobrani.Text == string.Empty)
         {
             txt_ToJobrani.Text = "0";
         }
         if (txt_FromDate.Text == string.Empty)
         {
             txt_FromDate.Text = "0";
         }
         if (txt_FromDate.Text == string.Empty)
         {
             txt_FromDate.Text = "0";
         }
         if (txt_NumberAbsence.Text == string.Empty)
         {
             txt_NumberAbsence.Text = "0";
         }
         if (txt_CodeOstad.Text == null || txt_CodeOstad.Text == "")
         {
             txt_CodeOstad.Text = "0";
         }
         if (rdb_YesAbsencesNoCountervailing.Checked == true)
         {
             if ((txt_FromDate.Text == "  /  /  ") || (txt_ToDate.Text == "  /  /  "))
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ ، تا تاریخ را پر کنید", 0, 100, "پیام", "");
             }
             else
             {
                 DataTable dtResault = FRB.GetAbsenceButNoCompensationProf(ddl_Term.SelectedValue, int.Parse(ddl_GroupOstad.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text), txt_FromDate.Text, txt_ToDate.Text, int.Parse(txt_NumberAbsence.Text));
                 if (dtResault.Rows.Count == 0)
                 {
                     RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
                 }
                 else
                 {
                     img_ExportToExcel1.Visible = true;
                     this.StiWebViewer1.ResetReport();
                     StiWebViewer1.Visible = true;
                     StiReport rpt = new StiReport();
                     rpt.Load(Server.MapPath("../Report/ReportAbsenceButNoCompensation.mrt"));
                     rpt.ReportCacheMode = StiReportCacheMode.On;
                     rpt.Dictionary.Databases.Clear();
                     rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                     rpt.Compile();
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@Term"].ParameterValue         = ddl_Term.SelectedValue;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@Departman"].ParameterValue    = int.Parse(ddl_GroupOstad.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@Daneshkade"].ParameterValue   = int.Parse(ddl_Daneshkade.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@CodeOstad"].ParameterValue    = int.Parse(txt_CodeOstad.Text);
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@FromDate"].ParameterValue     = txt_FromDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@ToDate"].ParameterValue       = txt_ToDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[SP_AbsenceButNoCompensation]"].Parameters["@CountAbsence"].ParameterValue = int.Parse(txt_NumberAbsence.Text);
                     rpt.RegData(dtResault);
                     rpt.Dictionary.Synchronize();
                     //rpt.Show();
                     StiWebViewer1.Report  = rpt;
                     StiWebViewer1.Visible = true;
                     //rpt.Print(true);
                 }
             }
         }
         if (rdb_YesAbsenceYesCountervailing.Checked == true)
         {
             if (txt_FromDate.Text == "  /  /  " || txt_ToDate.Text == "  /  /  ")
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ تا تاریخ  پر کنید", 0, 100, "پیام", "");
             }
             if (txt_AzJobrani.Text == "  /  /  " || txt_ToJobrani.Text == "  /  /  ")
             {
                 RadWindowManager1.RadAlert("لطفا از تاریخ جبرانی تا تاریخ جبرانی را پر کنید", 0, 100, "پیام", "");
             }
             else
             {
                 DataTable dtResault = FRB.GetAbsenceAndCompensationProf(ddl_Term.SelectedValue, int.Parse(ddl_GroupOstad.SelectedValue), int.Parse(ddl_Daneshkade.SelectedValue), int.Parse(txt_CodeOstad.Text), txt_FromDate.Text, txt_ToDate.Text, int.Parse(txt_NumberAbsence.Text), txt_AzJobrani.Text, txt_ToJobrani.Text);
                 if (dtResault.Rows.Count == 0)
                 {
                     RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
                 }
                 else
                 {
                     img_ExportToExcel2.Visible = true;
                     this.StiWebViewer1.ResetReport();
                     StiWebViewer1.Visible = true;
                     StiReport rpt = new StiReport();
                     rpt.Load(Server.MapPath("../Report/ReportAbsenceAndCompensation.mrt"));
                     rpt.ReportCacheMode = StiReportCacheMode.On;
                     rpt.Dictionary.Databases.Clear();
                     rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                     rpt.Compile();
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@Term"].ParameterValue         = ddl_Term.SelectedValue;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@Departman"].ParameterValue    = int.Parse(ddl_GroupOstad.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@Daneshkade"].ParameterValue   = int.Parse(ddl_Daneshkade.SelectedValue);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@CodeOstad"].ParameterValue    = int.Parse(txt_CodeOstad.Text);
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@AzJobrani"].ParameterValue    = txt_AzJobrani.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@TaJobrani"].ParameterValue    = txt_ToJobrani.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@FromDate"].ParameterValue     = txt_FromDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@ToDate"].ParameterValue       = txt_ToDate.Text;
                     rpt.CompiledReport.DataSources["[Faculty].[Sp_AbsenceAndCompensation]"].Parameters["@CountAbsence"].ParameterValue = int.Parse(txt_NumberAbsence.Text);
                     rpt.RegData(dtResault);
                     rpt.Dictionary.Synchronize();
                     //rpt.Show();
                     StiWebViewer1.Report  = rpt;
                     StiWebViewer1.Visible = true;
                     //rpt.Print(true);
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
        protected void grdProfessorStatus_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //System.Threading.Thread.Sleep(5000);
            if (e.CommandName == "send")
            {
                GridViewRow            curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                DropDownList           drpStatus  = (DropDownList)curruntRow.FindControl("drpUserStatus") as DropDownList;
                string                 status     = drpStatus.SelectedValue;
                string                 UserName   = e.CommandArgument.ToString();
                FacultyReportsBusiness FRB        = new FacultyReportsBusiness();
                try
                {
                    DataTable user = FRB.GetInfoPeoByCodeMeli(UserName);

                    string lastStatus = drpStatus.Items.FindByValue(user.Rows[0]["status"].ToString()).Text;
                    string newStatus  = drpStatus.Items.FindByValue(status).Text;
                    if (canChangeStatus(Convert.ToInt32(user.Rows[0]["status"]), Convert.ToInt32(status)))
                    {
                        FRB.UpdateInfoPeopleStatus(UserName, status);

                        CommonBusiness cb = new CommonBusiness();
                        cb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), (int)DTO.eventEnum.تغییر_وضعیت_استاد, " تغییر وضعیت از " + lastStatus + " به " + newStatus, int.Parse(user.Rows[0]["ID"].ToString()));
                        RadWindowManager1.RadAlert("تغییر وضعیت استاد انجام شد.", 300, 100, "پیام سیستم", "");
                    }
                    else
                    {
                        RadWindowManager1.RadAlert(" تغییر وضعیت از " + lastStatus + " به " + newStatus + " امکان پذیر نمی باشد.", 300, 100, "پیام سیستم", "");
                    }
                    if (user.Rows.Count > 0)
                    {
                        grdProfessorStatus.DataSource = user;
                        grdProfessorStatus.DataBind();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    FRB = null;
                }
            }
            else if (e.CommandName == "Details")
            {
                Session["page"] = 4;
                Response.Redirect("ShowDetailInfo.aspx?ID=" + e.CommandArgument.ToString());
            }
            else if (e.CommandName == "History")
            {
                // TeacherName.InnerText ="کد استاد: "+ e.CommandArgument.ToString();
                CommonBusiness cmb = new CommonBusiness();

                lst_history.DataSource = cmb.getUserAndStudentLogByAppId(13, int.Parse(e.CommandArgument.ToString()));
                lst_history.DataBind();


                //rgHistoryGrid.DataSource = cmb.getUserAndStudentLogByAppId(13, int.Parse(e.CommandArgument.ToString()), 5);
                //rgHistoryGrid.DataBind();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
            }
        }
        private void CreateRequest()
        {
            RequestFR req = new RequestFR();

            req.CatID    = Convert.ToInt32(drpCategory.SelectedValue);
            req.Subject  = "nosub";
            req.Note     = txtDescription.Text;
            req.Location = drpLocation.SelectedValue;
            RC_User        user  = new RC_User();
            RC_UserHandler us    = new RC_UserHandler();
            var            user1 = Session["UserName"].ToString();

            //user = us.Get_Ostad_DetailsByCourseId(Convert.ToInt32(drpCourse.SelectedValue));
            req.IssuerID   = int.Parse(Session[sessionNames.userID_Karbar].ToString());
            req.IssuerName = Session["UserName"].ToString();
            //int coursedid = Convert.ToInt32(drpCourse.SelectedValue);
            req.Capacity   = Convert.ToInt32(txtCapacity.Text);
            req.CourseName = txt_courseName.Text;
            req.DaneshID   = 5;//dorehaye kootah modat
            req.CourseDID  = 0;
            req.Issue_time = DateTime.Now.ToPeString();
            req.Status     = (int)RequestStatus.sent;
            if (chbRepeat.Checked == false)
            {
                if (CheckReqDate(pcal1.Text))
                {
                    RequestDateTime rdt = new RequestDateTime();
                    rdt.Date          = pcal1.Text;
                    rdt.StartTime     = RadTimePicker1.SelectedTime.Value.Ticks;
                    rdt.EndTime       = RadTimePicker2.SelectedTime.Value.Ticks;
                    req.DateTimeRange = new List <RequestDateTime>();
                    req.DateTimeRange.Add(rdt);
                }
                else
                {
                    string scrp = "تاریخ درخواست باید بعد از تاریخ امروز باشد.";
                    RadWindowManager1.RadAlert(scrp, 300, 100, "خطا", "");
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", scrp, true);
                    return;
                }
            }
            else
            {
                if (CheckReqDate(pcal1.Text) && CheckReqDate(pcal2.Text))
                {
                    req.DateTimeRange = FillRequestDateTime(pcal1.Text, pcal2.Text, RadTimePicker1.SelectedTime, RadTimePicker2.SelectedTime, chblWeekDates);
                }
                else
                {
                    string scrp = "تاریخ درخواست باید بعد از تاریخ امروز باشد.";//باید این پیام عوض شود.
                    RadWindowManager1.RadAlert(scrp, 300, 100, "خطا", "");
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", scrp, true);
                    return;
                }
            }

            optlist = new List <Option>();
            foreach (ListItem item in chblOptions.Items)
            {
                if (item.Selected)
                {
                    Option opt = new Option();
                    opt.ID       = Convert.ToInt32(item.Value);
                    opt.Name     = item.Text;
                    opt.IsActive = item.Selected;
                    optlist.Add(opt);
                }
            }
            RequestHandler rqh = new RequestHandler();

            //DataTable dt = rqh.HasRequestBefore(req.IssuerID, req.DateTimeRange);
            //if (dt.Rows.Count > 0)
            //{
            //    if (dt.Select().ToList().Exists(row => row["MayConflict"].ToString() == "1"))
            //    {
            //        string scrp = "تداخل در ساعت و تاریخ درخواست ، با ساعات درخواست های پیشین این استاد.";
            //        RadWindowManager1.RadAlert(scrp, 300, 100, "خطا", "");

            //        return;
            //    }
            //}
            if (RequestHandler.IsNotSpecifiedDay(DayOfWeek.Friday, req.DateTimeRange))
            {
                string scrp = "در روز جمعه امکان برگزاری وجود ندارد";
                RadWindowManager1.RadAlert(scrp, 300, 100, "خطا", "");

                return;
            }
            try
            {
                var address = ViewState["GoBackTo"].ToString();
                int reqid   = rqh.AddNewRequest(req, optlist, Session[sessionNames.userID_Karbar].ToString());

                var comman = new CommonBusiness();
                comman.InsertIntoUserLog(Convert.ToInt32(Session[sessionNames.userID_Karbar].ToString()), "", 11, 114, "ثبت درخواست کلاس دوره کوتاه مدت", reqid);

                string resdirectFunc = "function redirectToLast(){ window.location= '" + address + "' ; }";
                string scrp          = "درخواست شما با شماره " + reqid.ToString() + " با موفقیت ثبت گردید";
                RadWindowManager1.RadAlert(scrp, 300, 100, "پیام سیستم", resdirectFunc);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 15
0
        protected void cmdEjecuta_Click(object sender, EventArgs e)
        {
            valResumen.ValidationGroup = "get";
            Page.Validate("get");
            if (Page.IsValid)
            {
                try
                {
                    String param = AgregarCat();
                    subirArchivoCALIDAD();

                    if (param.CompareTo("F") == 0)
                    {
                        RadWindowManager1.RadAlert("Se genero el Siguiente Error: " + Session["error_Reporte"].ToString() + ", Favor de verificar con el Administrador de sistemas...", 450, 300, "Captura del día", null);
                    }
                    else
                    {
                        RadWindowManager1.RadAlert("Captura ingresada con éxito...", 300, 200, "Captura del día", null);
                    }

                    string script = "function f(){CloseAndRebind(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
                }
                catch (SqlException ex)
                {
                    convertir.log("Error: " + ex.Message.ToString() + ", fecha: " + DateTime.Now.ToString());
                    RadWindowManager1.RadAlert("Error: " + ex.Message.ToString(), 300, 100, "Captura del día", null);
                }
            }
            else
            {
                #region parametrosColor

                if (cmbinstalacion.SelectedValue != null && cmbinstalacion.SelectedValue.Length > 0)
                {
                    cmbinstalacion.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff");
                }
                //cmbinstalacion.Attributes.Add("style", "border-color: #468847;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                else
                {
                    cmbinstalacion.BackColor = System.Drawing.ColorTranslator.FromHtml("#b94a48");
                }
                // cmbinstalacion.Attributes.Add("style", "border-color:#b94a48;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");

                if (cmbservicio.Text.Length > 0)
                {
                    cmbservicio.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff");
                }
                else
                {
                    cmbservicio.BackColor = System.Drawing.ColorTranslator.FromHtml("#b94a48");
                }

                if (cmbproducto.Text.Length > 0)
                {
                    cmbproducto.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff");
                }
                else
                {
                    cmbproducto.BackColor = System.Drawing.ColorTranslator.FromHtml("#b94a48");
                }

                if (addordenservicio.Text.Length > 0)
                {
                    addordenservicio.Attributes.Add("style", "border-color: #468847;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }
                else
                {
                    addordenservicio.Attributes.Add("style", "border-color:#b94a48;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }

                if (addcantidadinsp.Text.Length > 0)
                {
                    addcantidadinsp.Attributes.Add("style", "border-color: #468847;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }
                else
                {
                    addcantidadinsp.Attributes.Add("style", "border-color:#b94a48;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }



                if (rdpFecha.SelectedDate.HasValue)
                {
                    rdpFecha.BackColor = System.Drawing.ColorTranslator.FromHtml("#468847");
                }
                else
                {
                    rdpFecha.BackColor = System.Drawing.ColorTranslator.FromHtml("#b94a48");
                }

                if (addfoliocantidad02.Text.Length > 0)
                {
                    addfoliocantidad02.Attributes.Add("style", "border-color: #468847;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }
                else
                {
                    addfoliocantidad02.Attributes.Add("style", "border-color:#b94a48;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }

                if (addfoliocalidad02.Text.Length > 0)
                {
                    addfoliocalidad02.Attributes.Add("style", "border-color: #468847;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }
                else
                {
                    addfoliocalidad02.Attributes.Add("style", "border-color:#b94a48;  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);");
                }
                #endregion
                RadWindowManager1.RadAlert("Existen registros obligatorios, favor de corregir ", 300, 100, "Captura por centro", null);
            }
        }
Ejemplo n.º 16
0
        private void closingAddNewRow()
        {
            int rowIndex = 0;

            if (ViewState["CurrentTableClosing"] != null)
            {
                DropDownList ddlPostCallAnalysis;
                DropDownList ddlPhysicianRequest;
                DropDownList ddlNextCallObjective;
                DropDownList ddlSample;

                VisitClosing = (DataTable)ViewState["CurrentTableClosing"];
                DataRow drCurrentRowClosing = null;
                if (VisitClosing.Rows.Count > 0)
                {
                    for (int i = 1; i <= VisitClosing.Rows.Count; i++)
                    {
                        ddlPostCallAnalysis  = (DropDownList)gvClosing.Rows[rowIndex].Cells[0].FindControl("ddlPostCallAnalysis");
                        ddlPhysicianRequest  = (DropDownList)gvClosing.Rows[rowIndex].Cells[1].FindControl("ddlPhysicianRequest");
                        ddlNextCallObjective = (DropDownList)gvClosing.Rows[rowIndex].Cells[2].FindControl("ddlNextCallObjective");
                        ddlSample            = (DropDownList)gvClosing.Rows[rowIndex].Cells[3].FindControl("ddlSample");

                        if (ddlPostCallAnalysis.SelectedValue == "0")
                        {
                            RadWindowManager1.RadAlert("Select Valid Post Call Analysis ", 400, 200, "Alert!", null, "");
                            return;
                        }
                        if (ddlNextCallObjective.SelectedValue == "0")
                        {
                            RadWindowManager1.RadAlert("Select Valid Next Call Objective", 400, 200, "Alert!", null, "");
                            return;
                        }

                        drCurrentRowClosing    = VisitClosing.NewRow();
                        drCurrentRowClosing[0] = i + 1;

                        VisitClosing.Rows[i - 1]["PostCallAnalysisName"] = ddlPostCallAnalysis.SelectedValue;
                        VisitClosing.Rows[i - 1]["RequestName"]          = ddlPhysicianRequest.SelectedValue;
                        VisitClosing.Rows[i - 1]["NextCallObjName"]      = ddlNextCallObjective.SelectedValue;
                        VisitClosing.Rows[i - 1]["SampleName"]           = ddlSample.SelectedValue;

                        rowIndex++;
                    }
                    VisitClosing.Rows.Add(drCurrentRowClosing);
                    ViewState["CurrentTableClosing"] = VisitClosing;

                    gvClosing.DataSource = VisitClosing;
                    gvClosing.DataBind();

                    ddlPostCallAnalysis = (DropDownList)gvClosing.Rows[rowIndex].Cells[0].FindControl("ddlPostCallAnalysis");
                    ddlPostCallAnalysis.Focus();

                    ddlPhysicianRequest = (DropDownList)gvClosing.Rows[rowIndex].Cells[1].FindControl("ddlPhysicianRequest");
                    ddlPhysicianRequest.Focus();

                    ddlNextCallObjective = (DropDownList)gvClosing.Rows[rowIndex].Cells[2].FindControl("ddlNextCallObjective");
                    ddlNextCallObjective.Focus();

                    ddlSample = (DropDownList)gvClosing.Rows[rowIndex].Cells[3].FindControl("ddlSample");
                    ddlSample.Focus();
                }
            }
            else
            {
                Response.Write("ViewState is null");
            }
            closingSetPreviousData();
        }
Ejemplo n.º 17
0
    protected void RdGrd_TaskDetDir1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "CustomerName")
            {
                int iCustomerRSN = Convert.ToInt32(e.CommandArgument);
                LoadCustomerProfile(iCustomerRSN);
            }
            else if (e.CommandName == "Activities")
            {
                string     strProspectRSN = Convert.ToString(e.CommandArgument);
                LinkButton lnktaskid      = (LinkButton)e.Item.FindControl("lnktaskid");
                string     strtaskid      = lnktaskid.Text;
                Int64      istaffid       = Convert.ToInt64(strProspectRSN);
                Session["ProspectRSN"] = istaffid.ToString();
                Session["DiaryFrom"]   = "FromMyTasks";
                LoadProspectDiary(strProspectRSN, strtaskid.ToString());
                rwDiary.Visible = true;
            }

            else if (e.CommandName == "Pink")
            {
                int     iTaskID = Convert.ToInt32(e.CommandArgument);
                DataSet dscheck = sqlobj.SQLExecuteDataset("sp_GetTaskdetail",
                                                           new SqlParameter()
                {
                    ParameterName = "@RSN", SqlDbType = SqlDbType.BigInt, Value = iTaskID.ToString()
                });

                if (dscheck.Tables[0].Rows.Count > 0)
                {
                    string strstaffid    = dscheck.Tables[0].Rows[0]["StaffID"].ToString();
                    string assignedby    = dscheck.Tables[0].Rows[0]["AssignedBy"].ToString();
                    string strcustomer   = dscheck.Tables[0].Rows[0]["Name"].ToString();
                    string stractivity   = dscheck.Tables[0].Rows[0]["ActivityAssigned"].ToString();
                    string strreference  = dscheck.Tables[0].Rows[0]["AssigneeCommnts"].ToString();
                    string strtargetdate = dscheck.Tables[0].Rows[0]["TargetDate"].ToString();

                    sqlobj.ExecuteSQLNonQuery("sp_insertping",
                                              new SqlParameter()
                    {
                        ParameterName = "@fromid", SqlDbType = SqlDbType.NVarChar, Value = assignedby.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@toid", SqlDbType = SqlDbType.NVarChar, Value = strstaffid.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@name", SqlDbType = SqlDbType.NVarChar, Value = strcustomer.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@reference", SqlDbType = SqlDbType.NVarChar, Value = strreference.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@activity", SqlDbType = SqlDbType.NVarChar, Value = stractivity.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@targetdate", SqlDbType = SqlDbType.DateTime, Value = strtargetdate.ToString()
                    },
                                              new SqlParameter()
                    {
                        ParameterName = "@Createdby", SqlDbType = SqlDbType.NVarChar, Value = Session["UserID"].ToString()
                    }

                                              );
                    RadWindowManager1.Title = "Ping for Status request and Content";
                    RadWindowManager1.RadAlert("Progress update request mailed to " + strstaffid, null, null, null, null, null);
                }
            }
            else if (e.CommandName.ToString() == "StaffUpdate")
            {
                GridDataItem griditem = e.Item as GridDataItem;
                string       strRef   = griditem["Reference"].Text.ToString();
                if (strRef == "#Aptmnt")
                {
                    // Response.Redirect("~/Calendar.aspx");
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Calendar", "NavigateCalendar();", true);
                }
                else
                {
                    string   args   = e.CommandArgument.ToString();
                    string[] spargs = args.Split(';');
                    Session["TaskID"] = spargs[0].ToString();
                    //Session["TaskID"] = e.CommandArgument.ToString();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Function", "NavigateDir2('" + spargs[1].ToString() + "');", true);
                }
            }
            else
            {
                string StaffID = QSUserName;
                LoadTaskDetDir1(StaffID);
            }
        }
        catch (Exception ex)
        {
            WebMsgBox.Show(ex.Message);
        }
    }
Ejemplo n.º 18
0
        private int prepareToSave()
        {
            int iResult = 0;
            int i       = 0;

            foreach (GridViewRow r in gvParticipants.Rows)
            {
                DropDownList ddlAff = (DropDownList)gvParticipants.Rows[i].Cells[0].FindControl("ddlAff");
                DataRow      rP     = VisitParticipantsSave.NewRow();
                rP[0] = int.Parse(ddlAff.SelectedValue);
                VisitParticipantsSave.Rows.Add(rP);
                i++;
            }

            int j = 0;

            foreach (GridViewRow r in gvMessages.Rows)
            {
                DropDownList ddlProduct            = (DropDownList)gvMessages.Rows[j].Cells[0].FindControl("ddlProduct");
                DropDownList ddlAdoptionLadderStep = (DropDownList)gvMessages.Rows[j].Cells[1].FindControl("ddlAdoptionLadderStep");

                DataRow rM = VisitMessagesSave.NewRow();
                rM[0] = int.Parse(ddlProduct.SelectedValue);
                rM[1] = int.Parse(ddlAdoptionLadderStep.SelectedValue);
                VisitMessagesSave.Rows.Add(rM);
                j++;
            }

            int k = 0;

            foreach (GridViewRow r in gvClosing.Rows)
            {
                DropDownList ddlPostCallAnalysis  = (DropDownList)gvClosing.Rows[k].Cells[0].FindControl("ddlPostCallAnalysis");
                DropDownList ddlPhysicianRequest  = (DropDownList)gvClosing.Rows[k].Cells[1].FindControl("ddlPhysicianRequest");
                DropDownList ddlNextCallObjective = (DropDownList)gvClosing.Rows[k].Cells[0].FindControl("ddlNextCallObjective");
                DropDownList ddlSample            = (DropDownList)gvClosing.Rows[k].Cells[1].FindControl("ddlSample");

                if (ddlPostCallAnalysis.SelectedValue == "0")
                {
                    RadWindowManager1.RadAlert("Select Valid Post Call Analysis ", 400, 200, "Alert!", null, "");
                    iResult = 1;
                }
                if (ddlNextCallObjective.SelectedValue == "0")
                {
                    RadWindowManager1.RadAlert("Select Valid Next Call Objective", 400, 200, "Alert!", null, "");
                    iResult = 2;
                }

                DataRow rC = VisitClosingSave.NewRow();
                rC[0] = int.Parse(ddlPostCallAnalysis.SelectedValue);
                rC[1] = int.Parse(ddlPhysicianRequest.SelectedValue);
                rC[2] = int.Parse(ddlNextCallObjective.SelectedValue);
                rC[3] = int.Parse(ddlSample.SelectedValue);
                VisitClosingSave.Rows.Add(rC);
                k++;
            }
            return(iResult);

            //participantsSetRowData();
            //messagesSetRowData();
            //closingSetRowData();

            //DataTable tblParticipant = ViewState["CurrentTable"] as DataTable;
            //DataTable tblMessage = ViewState["CurrentTable2"] as DataTable;
            //DataTable tblClosing = ViewState["CurrentTableClosing"] as DataTable;

            //if(tblParticipant != null)
            //{
            //    foreach(DataRow r in tblParticipant.Rows)
            //    {
            //        DataRow rP = VisitParticipantsSave.NewRow();
            //        rP[0] =
            //        VisitParticipantsSave.Rows.Add();
            //    }
            //}
        }
        protected void btnSubmitChanges_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                string msg = "";
                if (!isInformationValid())
                {
                    return;
                }
                if (ProfReqBuss.HasPendingRequest(Convert.ToInt32(Session[sessionNames.userID_StudentOstad]), (int)RequestTypeId.EditContactInfo))
                {
                    msg = "شما به دلیل وجود درخواست تایید نشده از این نوع درخواست نمی توانید درخواست جدید ثبت کنید.";
                    RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain");
                    return;
                }
                List <ChangedInfoDTO> oFullChangeList = (List <ChangedInfoDTO>)ViewState["ChangeList"];
                foreach (Control item in dvAddressFileds.Controls)
                {
                    if (item is TextBox)
                    {
                        TextBox        txt    = (TextBox)item;
                        ChangedInfoDTO result = oFullChangeList.Find(i => i.ControlId == txt.ID);
                        if (result.OldValue != txt.Text)
                        {
                            result.NewValue = txt.Text;
                            result.State    = FieldChangeState.Submitted;
                        }
                    }
                }

                ChangedInfoDTO resultDrp;
                resultDrp = oFullChangeList.Find(i => i.ControlId == drpLivingCity.ID + "value");

                if (resultDrp?.OldValue != drpLivingCity.SelectedValue && drpLivingCity.SelectedItem.Value != "0")
                {
                    resultDrp.NewValue = drpLivingCity.SelectedValue;
                    resultDrp.State    = FieldChangeState.Submitted;
                }

                //------------------------------
                resultDrp = oFullChangeList.Find(i => i.ControlId == drpProvince1.ID + "value");

                if (resultDrp?.OldValue != drpProvince1.SelectedValue && drpProvince1.SelectedItem.Value != "0")
                {
                    resultDrp.NewValue = drpProvince1.SelectedValue;
                    resultDrp.State    = FieldChangeState.Submitted;
                }

                //------------------------------

                resultDrp = oFullChangeList.Find(i => i.ControlId == drpProvince2.ID + "value");

                if (resultDrp?.OldValue != drpProvince2.SelectedValue && drpProvince2.SelectedItem.Value != "0")
                {
                    resultDrp.NewValue = drpProvince2.SelectedValue;
                    resultDrp.State    = FieldChangeState.Submitted;
                }
                //------------------------------

                resultDrp = oFullChangeList.Find(i => i.ControlId == drpWorkingCity.ID + "value");

                if (resultDrp?.OldValue != drpWorkingCity.SelectedValue && drpWorkingCity.SelectedItem.Value != "0")
                {
                    resultDrp.NewValue = drpWorkingCity.SelectedValue;
                    resultDrp.State    = FieldChangeState.Submitted;
                }

                //------------------------------

                ProfessorEditRequestDTO oEditDTO = new ProfessorEditRequestDTO();
                oEditDTO.Code_Ostad       = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]);
                oEditDTO.Createdate       = DateTime.Now.ToPeString();
                oEditDTO.RequestTypeID    = (int)RequestTypeId.EditContactInfo; // درخواست ویرایش اطلاعات تماس
                oEditDTO.RequestLogID     = (int)RequestLogId.submitted;        // در حال بررسی
                oEditDTO.HR_InfoPeople_Id = Convert.ToInt32(Session["hrInfoPeopleId"]);
                oEditDTO.ChangeSet        = 1;
                oEditDTO.ChangeList       = new List <ChangedInfoDTO>();
                foreach (ChangedInfoDTO item in oFullChangeList)
                {
                    if (!string.IsNullOrWhiteSpace(item.NewValue) && item.NewValue != item.OldValue)
                    {
                        item.State = FieldChangeState.Submitted;
                        oEditDTO.ChangeList.Add(item);
                    }
                }
                if (oEditDTO.ChangeList.Count == 0)
                {
                    msg = "شما هیچ تغییری در این بخش به وجود نیاورده اید.";
                    RadWindowManager1.RadAlert(msg, 400, 100, "پیام سیستم", "");
                    return;
                }
                int Id = ProfReqBuss.AddNewEditRequest(oEditDTO);
                msg = null;
                if (Id > 0)
                {
                    CB.InsertIntoStudentLog(oEditDTO.HR_InfoPeople_Id.ToString(), DateTime.Now.ToString("HH:mm"), 13, 32, Id.ToString());
                    msg = "درخواست شما با شماره " + Id.ToString() + "با موفقیت ثبت گردید.";
                    Session["hrInfoPeopleId"] = null;
                }
                else
                {
                    msg = "خطا در هنگام ثبت درخواست ، لطفا مجددا تلاش کنید.";
                }

                RadWindowManager1.RadAlert(msg, 400, 100, "پیام سیستم", "RedirectToMain");
            }
        }
Ejemplo n.º 20
0
        protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
        {
            string SavedDoc = string.Empty;
            string fileName = string.Empty;

            // try
            {
                int i = RadAsyncUpload1.InitialFileInputsCount;
                try
                {
                    using (Stream str = e.File.InputStream);
                }
                catch
                {
                    string strError = "<Script>FileTimedOut()</script>";
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "strError", strError);
                    return;
                }
                using (Stream str = e.File.InputStream)
                {
                    byte[] content = new byte[str.Length];
                    content = ReadFully(str);
                    uploadedFiles.Add(content);

                    fileName = e.File.FileName.Replace("'", "");
                    Oracle.DataAccess.Client.OracleConnection conn = SQLStatic.SQL.OracleConnection();

                    try
                    {
                        SQLStatic.Sessions.SetSessionValue(session_id, "UPLOAD_MESSAGE", txtmsgUpload.Text);
                        Data.SavePDF(session_id, fileName, content);
                        hidUpload.Value = "1";
                    }
                    catch
                    {
                    }
                    str.Read(content, 0, content.Length);
                    ViewState["Docs"] = ViewState["Docs"].ToString() + "<li>" + fileName + "</li>";
                }
            }
            //catch
            //{
            //    ViewState["Error"] = "T";
            //}
            if (hidcount.Value.Length > 0)
            {
                hidcount.Value = hidcount.Value.Remove(0, 1);
            }

            if (hidcount.Value.Length == 0)
            {
                if (!string.IsNullOrEmpty(ViewState["Docs"].ToString()))
                {
                    SavedDoc = "<br/><u><b>Documents Uploaded Successfully</b></u><ul>" + ViewState["Docs"].ToString() + "</ul>";
                }
                if (ViewState["Error"].ToString().Equals("F"))
                {
                    ConfromSave(SavedDoc);
                }
                else
                {
                    if (string.IsNullOrEmpty(ViewState["Docs"].ToString()))
                    {
                        SavedDoc = "<br/><br/><u><b>Documents Uploaded Successfully</b></u><ul> None</ul>";
                    }
                    else
                    {
                        SavedDoc = "<br/><br/><u><b>Documents Uploaded Successfully</b></u><ul>" + ViewState["Docs"].ToString() + "</ul>";
                    }
                    RadWindowManager1.RadAlert("Upload Failed. Please Try Again." + SavedDoc, 300, 200, "Upload Failed", null);
                }
                ViewState["Docs"] = string.Empty;
                //btnSubmit.Enabled = false;
            }
            txtmsgUpload.Text = string.Empty;
            rgDoc.Rebind();
            string strLE_EE_ID = SQLStatic.Sessions.GetSessionValue(session_id, "LE_EE_ID");
            string strGp       = "<Script>Go('" + strLE_EE_ID + "')</script>";

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "strGp", strGp);
        }
Ejemplo n.º 21
0
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            //   lblCommitmentValidate.Visible = false;
            if (!Page.IsValid)
            {
                return;               //اینجا باید رد الرت باشه
            }
            // sadegh saryazdi
            //DateTime dateTime = new DateTime(2020, 04, 20);//اول اردیبهشت 1399
            //if (DateTime.Now > dateTime&&!CheckRequest()) return;//بررسی سه دفاع
            //این شرط را داخل در جاییی که شرط ها بررسی می‌شوند بگذار

            var userId = Session[sessionNames.userID_StudentOstad].ToString();
            StudentDefenceRequest request = new StudentDefenceRequest();
            var defInfo = _requestHandler.GetDefenceInformation(userId);

            if (userId == "99900999")
            {
                request = new StudentDefenceRequest
                {
                    CategoryId             = 2,
                    Subject                = "ارزیابی عملکرد تلفیقی فرایند بیولوژیکی و فیزیکوشیم",
                    Location               = "2",
                    Status                 = 0,
                    IssuerId               = 99900999,
                    IssuerName             = "محمد سرگزی",
                    Capacity               = 1,
                    DefenceSubject         = "ارزیابی عملکرد تلفیقی فرایند بیولوژیکی و فیزیکوشیم",
                    DaneshId               = 3,
                    CourseName             = "ارزیابی عملکرد تلفیقی فرایند بیولوژیکی و فیزیکوشیم",
                    RequestDate            = txtDate.Text,
                    RequestStartTime       = txtTime.SelectedTime.Value.Ticks,
                    OnlineTeacherRole      = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedValue : string.Empty,
                    OnlineFirstTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Text : string.Empty,
                    OnlineFirstTeacherId   = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Value.Substring(3) : string.Empty,

                    //sadeghsaryazdi

                    FlagDoingMeetingOnline = chkDoingOnlineDefence.Checked ? true : false,

                    // = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedItem.Text : string.Empty,
                    UseOwnPc = rdbOwnSystem.Checked,
                    UserId   = Session[sessionNames.userID_StudentOstad].ToString(),
                    Gender   = "1"
                };

                request.AcceptPropDate = "1397/11/27";
            }
            else
            {
                request = new StudentDefenceRequest
                {
                    CategoryId             = (int)Category.InPersonClass,
                    Subject                = StudentDefenceRequest.StaticStudentRequest().Subject,
                    Location               = ((int)Location.Raam).ToString(),
                    Status                 = (int)RequestStatus.submitted,
                    IssuerId               = Convert.ToInt32(Session[sessionNames.userID_StudentOstad].ToString()),
                    IssuerName             = defInfo.StudentFullName,
                    Capacity               = StudentDefenceRequest.StaticStudentRequest().Capacity,
                    DefenceSubject         = defInfo.DefenceSubject,
                    DaneshId               = Convert.ToInt32(defInfo.CollegeId),
                    CourseName             = defInfo.DefenceSubject,
                    RequestDate            = txtDate.Text,
                    RequestStartTime       = txtTime.SelectedTime.Value.Ticks,
                    OnlineTeacherRole      = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedValue : string.Empty,
                    OnlineFirstTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Text : string.Empty,
                    OnlineFirstTeacherId   = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Value.Substring(3) : string.Empty,

                    //sadeghsaryazdi

                    FlagDoingMeetingOnline = chkDoingOnlineDefence.Checked ? true : false,

                    // = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedItem.Text : string.Empty,
                    UseOwnPc = rdbOwnSystem.Checked,
                    UserId   = Session[sessionNames.userID_StudentOstad].ToString(),
                    Gender   = defInfo.studentGender
                };
                request.AcceptPropDate = defInfo.GroupAcceptDate;
            }
            if (rcbOnlineTeacher.Items.Count > 1)
            {
                request.OnlineSecondTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Text
                    : string.Empty;
                request.OnlineSecondTeacherId = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Value.Substring(3)
                    : string.Empty;
            }
            request.RequestEndTime = request.RequestStartTime + _requestHandler.GetDefenceInMeetingLength(Convert.ToInt32(defInfo.CollegeId));

            var reqId = 0;

            request.IsRequestEducation = false;
            var message = _requestHandler.CreateStudentRequestV2(out reqId, request);

            if (message.Contains("ok"))
            {
                defInfo.RequestDate = request.RequestDate;
                defInfo.StartTime   = request.RequestStartTime;
                defInfo.EndTime     = request.RequestEndTime;

                string scrp = message.Substring(2);
                //PrevPage = ViewState["PrevPage"].ToString();
                //var uri = Request.UrlReferrer.ToString();
                // _prevPage = uri.Replace("StudentAddRequest.aspx", "StudentReview.aspx");
                //var requestRawUrl = Request.RawUrl;
                CommonBusiness CommonBusiness = new CommonBusiness();
                CommonBusiness.InsertIntoStudentLog(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.ToString("HH:mm"), 11, 40, "ثبت درخواست رزرو جلسه دفاع توسط دانشجو", reqId);

                string address       = "../Forms/StudentReview.aspx";
                string resdirectFunc = "function redirectToLast(){ window.location= '" + address + "' ; }";
                RadWindowManager1.RadAlert(scrp, 500, 100, "پیام سیستم", resdirectFunc);
                //DateTime dateTimeEnd = RequestHandler.WorkingDays24h(DateTime.Now);
                DateTime dateTimeEnd = RequestHandler.WorkingDays12h(DateTime.Now);
                SendSmsContactBuisnes.SendSmsOsForOstadsDefence(userId, request.IssuerName,
                                                                request.RequestDate, dateTimeEnd.Date.ToPeString(), txtTime.SelectedTime.Value.ToString().Substring(0, 5), dateTimeEnd.Hour + ":" + dateTimeEnd.Minute);
            }
            else
            {
                RadWindowManager1.RadAlert(message, 500, 100, "خطا", "");
            }
        }
Ejemplo n.º 22
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Save":
                if (txtDenNgay.SelectedDate == null || txtTuNgay.SelectedDate <= txtDenNgay.SelectedDate)
                {
                    if (iDNghi == null)
                    {
                        Nghi ng = new Nghi();
                        ng.IDNhanVien = userid;
                        ng.IDLoaiNghi = Convert.ToInt32(cboLoaiNghi.SelectedValue);
                        ng.TuNgay     = txtTuNgay.SelectedDate;
                        ng.DenNgay    = txtDenNgay.SelectedDate;
                        if (lbSoNgayXinNghi.Text != "")
                        {
                            ng.SoNgayDaNghi = Convert.ToInt32(lbSoNgayXinNghi.Text);
                        }
                        ng.LyDoNghi = txtLyDo.Text;
                        ng.DuocNghi = null;
                        if (cboNhanVienBanGiao.SelectedValue == "")
                        {
                            ng.IDNhanVienBanGiao = null;
                        }
                        else
                        {
                            ng.IDNhanVienBanGiao = Convert.ToInt32(cboNhanVienBanGiao.SelectedValue);
                        }
                        ng.NguoiTao = ng.NguoiCapNhat = userid;
                        ng.NgayTao  = ng.NgayCapNhat = DateTime.Now;
                        _entities.AddToNghis(ng);
                        _entities.SaveChanges();
                        grvNghi.Rebind();
                        RadWindowManager1.RadAlert("Thêm thông tin thành công", 285, 100, "Thông báo", null);
                    }
                    else
                    {
                        Nghi ng = _entities.Nghis.Where(d => d.IDNghiPhep == iDNghi).First();
                        if (ng.DuocNghi == null)
                        {
                            ng.IDLoaiNghi = Convert.ToInt32(cboLoaiNghi.SelectedValue);
                            ng.TuNgay     = txtTuNgay.SelectedDate;
                            ng.DenNgay    = txtDenNgay.SelectedDate;
                            if (lbSoNgayXinNghi.Text != "")
                            {
                                ng.SoNgayDaNghi = Convert.ToInt32(lbSoNgayXinNghi.Text);
                            }
                            ng.LyDoNghi = txtLyDo.Text;
                            if (cboNhanVienBanGiao.SelectedValue == "")
                            {
                                ng.IDNhanVienBanGiao = null;
                            }
                            else
                            {
                                ng.IDNhanVienBanGiao = Convert.ToInt32(cboNhanVienBanGiao.SelectedValue);
                            }
                            ng.NguoiCapNhat = userid;
                            ng.NgayCapNhat  = DateTime.Now;
                            _entities.SaveChanges();
                            grvNghi.Rebind();
                            RadWindowManager1.RadAlert("Sửa thông tin thành công", 285, 100, "Thông báo", null);
                        }
                    }
                }
                else
                {
                    lbSoNgayXinNghi.Text = "Lỗi: thời gian xin nghỉ không hợp lý";
                }
                break;

            case "Reset":
                cboLoaiNghi.SelectedIndex        = -1;
                cboNhanVienBanGiao.SelectedIndex = -1;
                txtTuNgay.Clear();
                txtDenNgay.Clear();
                lbSoNgayXinNghi.Text = "";
                txtLyDo.Text         = "";
                lbSoNgayXinNghi.Text = "";
                iDNghi = null;
                ToogleControl(null);
                break;

            case "Report":
                RadWindowManager1.RadAlert("Chức năng chưa hoàn thiện", 285, 100, "Lỗi", "");
                break;
            }
        }
Ejemplo n.º 23
0
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        string valor = e.Argument;
        string tipo  = valor.Substring(0, 1);

        valor = valor.Substring(1);
        switch (tipo)
        {
        case "A":
            DateTime fechaBaja;
            if (DateTime.TryParse(valor, out fechaBaja))
            {
                revision.Dispositivo.Caducado  = true;
                revision.Dispositivo.FechaBaja = fechaBaja;
                ctx.SaveChanges();
                CntLainsaSci.EliminarRevisionesPendientes(revision.Dispositivo, ctx, revision);
                string mensaje = String.Format("El dispositivo ha sido dado de baja con fecha {0:dd/MM/yyyy}", fechaBaja);
                RadWindowManager1.RadAlert(mensaje, 330, 110, "DADO DE BAJA", "retornoAlert");
                RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'edit');", caller));
                //string jCommand = String.Format("radalert('{0}');", mensaje);
                //RadAjaxManager1.ResponseScripts.Add(jCommand);
            }
            else
            {
                string mensaje = (string)GetGlobalResourceObject("ResourceLainsaSci", "DateNeeded");
                mensaje = "La fecha introducida es incorrecta";
                RadWindowManager1.RadAlert(mensaje, 330, 110, "AVISO", "retornoAlert");
                //string jCommand = String.Format("radalert('{0}');", mensaje);
                //RadAjaxManager1.ResponseScripts.Add(jCommand);
            }
            break;

        case "B":
            if (valor == "true")
            {
                // quiere descambiar
                Sustitucion s  = revision.Sustitucions[0];    // solo tiene que estar el cambio inicial
                Sustitucion ns = new Sustitucion()
                {
                    DispositivoOriginal  = s.DispositivoSustituto,
                    DispositivoSustituto = s.DispositivoOriginal,
                    Fecha    = DateTime.Now,
                    Revision = revision
                };
                ns.Estado = "REALIZADA";     // si llega aquí es realizada fijo.
                // control de estados
                Dispositivo dspo = ns.DispositivoOriginal;
                Dispositivo dsps = ns.DispositivoSustituto;
                dspo.Estado = "A";
                if (dsps.Funcion == "R")
                {
                    dsps.Estado = "S";
                }
                else
                {
                    dsps.Estado = "N";
                }
                dsps.Posicion = dsps.Posicion;
                dspo.Posicion = "SUSTITUIDOS";
                ctx.Add(ns);
            }
            else
            {
                Sustitucion s = revision.Sustitucions[0];     // solo tiene que estar el cambio inicial
                s.DispositivoOriginal.Funcion = "R";
            }
            // Como si hubiera pulsado el botón.
            UnloadData(revision);
            CntLainsaSci.CTXGuardar(ctx);

            CntLainsaSci.EliminarInferiores(revision, ctx);
            CntLainsaSci.ProgramarSiguienteRevision(revision, ctx, true);
            CntLainsaSci.ProgramarInferiores(revision, ctx);
            RadAjaxManager1.ResponseScripts.Add(String.Format("closeWindowRefreshGrid('{0}', 'edit');", caller));
            break;
        }
    }
Ejemplo n.º 24
0
 protected void btn_ShowInfo_Click(object sender, EventArgs e)
 {
     img_ExportToExcel1.Visible = false;
     img_ExportToExcel2.Visible = false;
     if (ddl_Term.SelectedValue == null || ddl_Term.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("لطفا ترم را انتخاب نمایید", 0, 100, "پیام", "");
     }
     else if (ddl_Degree.SelectedValue == null || ddl_Degree.SelectedValue == "0")
     {
         RadWindowManager1.RadAlert("لطفا مقطع را انتخاب نمایید", 0, 100, "پیام", "");
     }
     else
     {
         if (rdb_Mardudi.Checked == true)
         {
             PSD.Percent = txt_Percent.Text;
             if (txt_Percent.Text == null || txt_Percent.Text == "")
             {
                 txt_Percent.Text = "0";
             }
             dtResault = FRB.GetStudentsProbation(ddl_Term.SelectedValue, int.Parse(ddl_Degree.SelectedValue), int.Parse(txt_Percent.Text));
             if (dtResault.Rows.Count == 0)
             {
                 RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
             }
             else
             {
                 //Report
                 img_ExportToExcel1.Visible = true;
                 this.StiWebViewer1.ResetReport();
                 StiWebViewer1.Visible = true;
                 StiReport rpt = new StiReport();
                 rpt.Load(Server.MapPath("../Report/ReportStudentProbation.mrt"));
                 rpt.ReportCacheMode = StiReportCacheMode.On;
                 rpt.Dictionary.Databases.Clear();
                 rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                 rpt.Compile();
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbation]"].Parameters["@Term"].ParameterValue    = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbation]"].Parameters["@Degree"].ParameterValue  = int.Parse(ddl_Degree.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbation]"].Parameters["@Percent"].ParameterValue = int.Parse(txt_Percent.Text);
                 rpt.RegData(dtResault);
                 rpt.Dictionary.Synchronize();
                 //rpt.Show();
                 StiWebViewer1.Report  = rpt;
                 StiWebViewer1.Visible = true;
                 //rpt.Print(true);
             }
         }
         else
         {
             PSD.Percent = txt_PercentGhabul.Text;
             if (txt_PercentGhabul.Text == null || txt_PercentGhabul.Text == "")
             {
                 txt_PercentGhabul.Text = "0";
             }
             dtResault = FRB.GetStudentsProbationAcceptance(ddl_Term.SelectedValue, int.Parse(ddl_Degree.SelectedValue), int.Parse(txt_PercentGhabul.Text));
             if (dtResault.Rows.Count == 0)
             {
                 RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیام", "");
             }
             else
             {
                 //Report
                 img_ExportToExcel2.Visible = true;
                 this.StiWebViewer1.ResetReport();
                 StiWebViewer1.Visible = true;
                 StiReport rpt = new StiReport();
                 rpt.Load(Server.MapPath("../Report/ReportStudentProbationAcceptance.mrt"));
                 rpt.ReportCacheMode = StiReportCacheMode.On;
                 rpt.Dictionary.Databases.Clear();
                 rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString()));
                 rpt.Compile();
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbationAcceptance]"].Parameters["@Term"].ParameterValue    = ddl_Term.SelectedValue;
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbationAcceptance]"].Parameters["@Degree"].ParameterValue  = int.Parse(ddl_Degree.SelectedValue);
                 rpt.CompiledReport.DataSources["[Faculty].[SP_StudentsProbationAcceptance]"].Parameters["@Percent"].ParameterValue = int.Parse(txt_PercentGhabul.Text);
                 rpt.RegData(dtResault);
                 rpt.Dictionary.Synchronize();
                 //rpt.Show();
                 StiWebViewer1.Report  = rpt;
                 StiWebViewer1.Visible = true;
                 //rpt.Print(true);
             }
         }
     }
 }
Ejemplo n.º 25
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Save":
                if (idHopDong == null)
                {
                    HopDongLD hd = new HopDongLD();
                    if (idNhanVien == null)
                    {
                        hd.IDNhanVien = Convert.ToInt32(cboNguoiLD.SelectedValue);
                    }
                    else
                    {
                        hd.IDNhanVien = idNhanVien;
                    }
                    if (_entities.HopDongLDs.Where(h => h.SoHD == txtSoHD.Text).FirstOrDefault() == null)
                    {
                        hd.SoHD               = txtSoHD.Text;
                        hd.NgayKyHD           = txtNgayKyHD.SelectedDate;
                        hd.IDLoaiHD           = Convert.ToInt32(cboLoaiHD.SelectedValue);
                        hd.TuNgay             = txtTuNgayKyHD.SelectedDate;
                        hd.DenNgay            = txtDenNgayKyHD.SelectedDate;
                        hd.IDNguoiDaiDien     = Convert.ToInt32(cboNguoiDaiDien.SelectedValue);
                        hd.IDCoCauToChuc      = Convert.ToInt32(cboDonViLamViec.SelectedValue);
                        hd.DiaDiemLamViec     = txtDiaDiemLamViec.Text;
                        hd.TrinhDoChuyenMon   = txtTrinhDoChuyenMon.Text;
                        hd.IDChucDanhNghiepVu = Convert.ToInt32(cboChucDanhNghiepVu.SelectedValue);
                        hd.IDChucDanhCongViec = Convert.ToInt32(cboChucDanhCongViec.SelectedValue);
                        hd.MucHuong           = Convert.ToInt32(txtMucHuong.Text);
                        hd.IDBacNgach         = Convert.ToInt32(cboBac.SelectedValue);
                        if (txtPhuCapCV.Text != "")
                        {
                            hd.PhuCapCV = Convert.ToDecimal(txtPhuCapCV.Text);
                        }
                        else
                        {
                            hd.PhuCapCV = null;
                        }
                        if (txtMucLuongToiThieu.Text != "")
                        {
                            hd.MucLuongToiThieu = Convert.ToDecimal(txtMucLuongToiThieu.Text);
                        }
                        else
                        {
                            hd.MucLuongToiThieu = null;
                        }
                        if (txtTepDinhKem.UploadedFiles.Count > 0)
                        {
                            string targetFolder = txtTepDinhKem.TargetFolder;
                            hd.TepDinhKem = Path.Combine(Server.MapPath(targetFolder), txtSoHD.Text.Replace("/", "_") + "_" + txtTepDinhKem.UploadedFiles[0].FileName.Replace(" ", "_"));
                        }
                        hd.GhiChu   = txtGhiChu.Text;
                        hd.NguoiTao = hd.NguoiCapNhat = idUser;
                        hd.NgayTao  = hd.NgayCapNhat = DateTime.Now;
                        _entities.AddToHopDongLDs(hd);
                        try
                        {
                            _entities.SaveChanges();
                            LoadGrid();
                            RadWindowManager1.RadAlert("Thêm thông tin thành công", 285, 100, "Thông báo", "");
                        }
                        catch (Exception ex)
                        {
                            RadWindowManager1.RadAlert("Thêm thông tin thất bại", 285, 100, "Lỗi", "");
                            throw ex;
                        }
                    }
                    else
                    {
                        RadWindowManager1.RadAlert("Đã tồn tại số hợp đồng này", 285, 100, "Lỗi", "");
                    }
                }
                else
                {
                    cboNguoiLD.ShowDropDownOnTextboxClick = false;
                    cboNguoiLD.ShowToggleImage            = false;
                    HopDongLD hopDongLD = _entities.HopDongLDs.Where(h => h.IDHopDongLD == idHopDong).FirstOrDefault();
                    hopDongLD.SoHD               = txtSoHD.Text;
                    hopDongLD.NgayKyHD           = txtNgayKyHD.SelectedDate;
                    hopDongLD.IDLoaiHD           = Convert.ToInt32(cboLoaiHD.SelectedValue);
                    hopDongLD.TuNgay             = txtTuNgayKyHD.SelectedDate;
                    hopDongLD.DenNgay            = txtDenNgayKyHD.SelectedDate;
                    hopDongLD.IDNguoiDaiDien     = Convert.ToInt32(cboNguoiDaiDien.SelectedValue);
                    hopDongLD.IDCoCauToChuc      = Convert.ToInt32(cboDonViLamViec.SelectedValue);
                    hopDongLD.DiaDiemLamViec     = txtDiaDiemLamViec.Text;
                    hopDongLD.TrinhDoChuyenMon   = txtTrinhDoChuyenMon.Text;
                    hopDongLD.IDChucDanhNghiepVu = Convert.ToInt32(cboChucDanhNghiepVu.SelectedValue);
                    hopDongLD.IDChucDanhCongViec = Convert.ToInt32(cboChucDanhCongViec.SelectedValue);
                    hopDongLD.MucHuong           = Convert.ToInt32(txtMucHuong.Text);
                    hopDongLD.IDBacNgach         = Convert.ToInt32(cboBac.SelectedValue);
                    if (txtPhuCapCV.Text != "")
                    {
                        hopDongLD.PhuCapCV = Convert.ToDecimal(txtPhuCapCV.Text);
                    }
                    if (txtMucLuongToiThieu.Text != "")
                    {
                        hopDongLD.MucLuongToiThieu = Convert.ToDecimal(txtMucLuongToiThieu.Text);
                    }
                    hopDongLD.GhiChu = txtGhiChu.Text;
                    if (txtTepDinhKem.UploadedFiles.Count > 0)
                    {
                        string targetFolder = txtTepDinhKem.TargetFolder;
                        hopDongLD.TepDinhKem = Path.Combine(Server.MapPath(targetFolder), txtSoHD.Text.Replace("/", "_") + "_" + txtTepDinhKem.UploadedFiles[0].FileName.Replace(" ", "_"));
                    }
                    hopDongLD.NgayCapNhat  = DateTime.Now;
                    hopDongLD.NguoiCapNhat = idUser;
                    try
                    {
                        _entities.SaveChanges();
                        RadWindowManager1.RadAlert("Sửa thông tin thành công", 285, 100, "Thông báo", "");
                        LoadGrid();
                    }
                    catch (Exception ex)
                    {
                        RadWindowManager1.RadAlert("Sửa thông tin thất bại", 285, 100, "Lỗi", "");
                        throw ex;
                    }
                }
                break;

            case "Reset":
                txtSoHD.Text = "/" + DateTime.Now.Year.ToString() + "/HĐLĐ/AITS.";
                txtNgayKyHD.Clear();
                cboLoaiHD.SelectedIndex = -1;
                txtTuNgayKyHD.Clear();
                txtDenNgayKyHD.Clear();
                cboNguoiLD.SelectedIndex          = -1;
                cboChucDanhNghiepVu.SelectedIndex = -1;
                cboChucDanhCongViec.SelectedIndex = -1;
                cboNgach.SelectedIndex            = -1;
                LoadBacNgach(Convert.ToInt32(cboNgach.SelectedValue));
                LoadHeSoBacNgach();
                txtTrinhDoChuyenMon.Text      = "";
                cboDonViLamViec.SelectedIndex = -1;
                txtMucLuongBHXH.Text          = "";
                txtMucHuong.Text              = "100";
                txtPhuCapCV.Text              = "";
                txtMucLuongToiThieu.Text      = "";
                cboNguoiDaiDien.SelectedIndex = -1;
                txtGhiChu.Text = "";
                txtTepDinhKem.UploadedFiles.Clear();
                idHopDong = null;
                break;

            case "Report":
                Session["PrintType"] = "HopDong";
                Response.Redirect("InHD.aspx");
                break;

            case "PhuLuc":
                if (Session["idHD"] != null)
                {
                    Response.Redirect("ThemPhuLucHD.aspx");
                }
                else
                {
                    RadWindowManager1.RadAlert("Chưa chọn hợp đồng", 285, 100, "Lưu ý", null);
                }
                break;
            }
        }
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            string message;

            if (!Page.IsValid)
            {
                return;               //اینجا باید رد الرت باشه
            }
            var defenceInformation = _requestHandler.GetDefenceInformation(hdnUserId.Value.ToString());
            var request            = new StudentDefenceRequest
            {
                CategoryId             = (int)Category.InPersonClass,
                Subject                = StudentDefenceRequest.StaticStudentRequest().Subject,
                Location               = ((int)Location.Raam).ToString(),
                Status                 = (int)RequestStatus.sent,
                IssuerId               = Convert.ToInt32(hdnUserId.Value.ToString()),
                IssuerName             = defenceInformation.StudentFullName,
                Capacity               = StudentDefenceRequest.StaticStudentRequest().Capacity,
                DefenceSubject         = defenceInformation.DefenceSubject,
                DaneshId               = Convert.ToInt32(defenceInformation.CollegeId),
                CourseName             = defenceInformation.DefenceSubject,
                RequestDate            = txtDate.Text,
                RequestStartTime       = txtTime.SelectedTime.Value.Ticks,
                OnlineTeacherRole      = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedValue : string.Empty,
                OnlineFirstTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Text : string.Empty,
                OnlineFirstTeacherId   = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[0].Checked ? rcbOnlineTeacher.Items[0].Value.Substring(3) : string.Empty,
                IsEquippingResource    = ckbOnlineShow.Checked,

                // = ckbAprroveOnline.Checked ? drpRoleTeacher.SelectedItem.Text : string.Empty,
                UseOwnPc = rdbOwnSystem.Checked,
                UserId   = Session[sessionNames.userID_Karbar].ToString(),
                Gender   = defenceInformation.studentGender,

                //sadeghsaryazdi
                FlagDoingMeetingOnline = chkDoingOnlineDefence.Checked ? true : false,
            };

            if (rcbOnlineTeacher.Items.Count > 1)
            {
                request.OnlineSecondTeacherName = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Text
                    : string.Empty;
                request.OnlineSecondTeacherId = ckbAprroveOnline.Checked && rcbOnlineTeacher.Items[1].Checked
                    ? rcbOnlineTeacher.Items[1].Value.Substring(3)
                    : string.Empty;
            }
            request.RequestEndTime     = request.RequestStartTime + _requestHandler.GetDefenceInMeetingLength(Convert.ToInt32(defenceInformation.CollegeId));
            request.AcceptPropDate     = defenceInformation.GroupAcceptDate;
            request.Id                 = Convert.ToInt32(hdnrequestId.Value);
            request.IsRequestEducation = true;
            message = _requestHandler.UpdateStudentRequestForEducation(request);



            if (message.Contains("ok"))
            {
                defenceInformation.RequestDate = request.RequestDate;
                defenceInformation.StartTime   = request.RequestStartTime;
                defenceInformation.EndTime     = request.RequestEndTime;

                string scrp = message.Substring(2);

                string address = "EducationStudentReview.aspx" + "?id=" + generaterandomstr() + "@A" + "0" + "-" + generaterandomstr();

                var userID = Convert.ToInt32(Session[sessionNames.userID_Karbar]);
                var comman = new CommonBusiness();
                comman.InsertIntoUserLog(userID, DateTime.Now.ToString("HH:mm"), 11, 166, string.Format("{0}", "ویرایش درخواست جلسه دفاع توسط دانشکده"), Convert.ToInt32(request.Id));

                //sadegh saryazdy
                //  _requestHandler.UpdateRequest_LinkMeeting(stcode,"")

                string resdirectFunc = "function redirectToLast(){ window.location= '" + address + "' ; }";
                RadWindowManager1.RadAlert(scrp, 500, 100, "پیام سیستم", resdirectFunc);
            }
            else
            {
                RadWindowManager1.RadAlert(message, 500, 100, "خطا", "");
            }
        }
Ejemplo n.º 27
0
        void ShowMessage(string msg)
        {
            //ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script  language = 'javascript' > alert('" + msg + "');</ script > ");

            RadWindowManager1.RadAlert(msg, 300, 200, "My Alert", "callBackFn", "myAlertImage.png");
        }
Ejemplo n.º 28
0
        protected void gridcccmex_ItemCommand(object sender, GridCommandEventArgs e)
        {
            int _idCampo = 0;
            //Int64? _idCampo2 = null;
            string _nombre = "";
            bool   bit     = false;

            if (e.CommandName == "updGrid")
            {
                cargarcentros();
                limpiarRegistros();
                bit = true;
            }
            else if (e.CommandName == "editGrid")
            {
                foreach (GridDataItem item in gridcccmex.MasterTableView.Items)
                {
                    if (item.Selected == true)
                    {
                        _idCampo = Convert.ToInt32(item.GetDataKeyValue("IdInst"));
                        //_idCampo2 = convertir.toNInt64(item.GetDataKeyValue("IdCentro"));
                        _nombre = item.GetDataKeyValue("Nombre").ToString();


                        addcentro.Text       = _nombre.ToString();
                        addidCentro.Text     = _idCampo.ToString();
                        addidCentro.ReadOnly = true;

                        cmdcentro.Text    = "Actualizar";
                        Session["opTipo"] = 2;
                        bit = true;
                        break;
                    }
                }
            }
            else if (e.CommandName == "delGrid")
            {
                foreach (GridDataItem item in gridcccmex.MasterTableView.Items)
                {
                    if (item.Selected == true)
                    {
                        _idCampo = convertir.toInt32(item.GetDataKeyValue("IdInst"));
                        String param = eliminarCat(_idCampo);
                        if (param.CompareTo("F") == 0)
                        {
                            RadWindowManager1.RadAlert("Se genero el Siguiente Error: " + Session["error_Reporte"].ToString() + ", Favor de verificar con el Administrador de sistemas...", 450, 300, "Eliminando Centro", null);
                        }
                        else
                        {
                            RadWindowManager1.RadAlert("Centro eliminado con éxito...", 300, 150, "Eliminando Centro", null);
                            gridcccmex.MasterTableView.SortExpressions.Clear();
                            gridcccmex.MasterTableView.GroupByExpressions.Clear();
                            cargarcentros();
                        }

                        bit = true;
                        break;
                    }
                }
            }

            if (bit == false)
            {
                RadWindowManager1.RadAlert("Debe seleccionar un registro....", 300, 100, "Registros", null);
            }
        }
Ejemplo n.º 29
0
 protected void LanzarAviso(string aviso)
 {
     RadWindowManager1.RadAlert(aviso, null, null, "AVISO", "noHaceNada");
 }
        protected void Btn_Show_Click(object sender, EventArgs e)
        {
            if (ddl_Term.SelectedValue == null)
            {
                ddl_Term.SelectedValue = "0";
            }
            if (ddl_Degree.SelectedValue == null)
            {
                ddl_Degree.SelectedValue = "0";
            }
            if (ddl_Sex.SelectedValue == null)
            {
                ddl_Sex.SelectedValue = "0";
            }
            if (txt_SalVorud.Text == null || txt_SalVorud.Text == "")
            {
                txt_SalVorud.Text = "0";
            }
            if (ddl_Education.SelectedValue == null)
            {
                ddl_Education.SelectedValue = "0";
            }
            if (txt_StCode.Text == string.Empty || txt_StCode.Text == "")
            {
                txt_StCode.Text   = "0";
                Session["stcode"] = txt_StCode.Text;
            }
            if (LDD.Field == null)
            {
                LDD.Field = "0";
            }

            dtResault = ERB.GetLisAdamSabtenam(ddl_Term.SelectedValue.ToString(), txt_StCode.Text, int.Parse(ddl_Degree.SelectedValue.ToString()), int.Parse(ddl_Education.SelectedValue.ToString()), int.Parse(ddl_Sex.SelectedValue.ToString()), txt_SalVorud.Text.ToString(), int.Parse(ddl_Field.SelectedValue));
            if (dtResault.Rows.Count == 0)
            {
                RadWindowManager1.RadAlert("رکوردی وجود ندارد", 0, 100, "پیغام", "");
            }
            else
            {
                img_ExportToExcel1.Visible = true;
                this.StiWebViewer1.ResetReport();
                StiWebViewer1.Visible = true;
                StiReport rpt = new StiReport();
                rpt.Load(Server.MapPath("../Report/ReportNotRegistrationLicense.mrt"));
                rpt.Dictionary.Databases.Clear();
                rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", cb.ReportConnection.ToString()));
                rpt.Compile();
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@StCode"].ParameterValue    = txt_StCode.Text;
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@Degree"].ParameterValue    = int.Parse(ddl_Degree.SelectedValue);
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@Education"].ParameterValue = int.Parse(ddl_Education.SelectedValue);
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@Sex"].ParameterValue       = int.Parse(ddl_Sex.SelectedValue);
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@SalVorud"].ParameterValue  = txt_SalVorud.Text;
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@Field"].ParameterValue     = int.Parse(ddl_Field.SelectedValue);
                rpt.CompiledReport.DataSources["[Education].[SP_NotRegistrationLicense]"].Parameters["@Term"].ParameterValue      = ddl_Term.SelectedValue;
                rpt.RegData(dtResault);
                rpt.Dictionary.Synchronize();
                //rpt.Show();
                StiWebViewer1.Report = rpt;
                StiWebViewer1.ProcessExcel2007Request();
                StiWebViewer1.ShowExportToExcel.ToString();
                StiWebViewer1.Visible = true;
                //rpt.Print(true);
            }
            Session["stcode"] = null;
        }