コード例 #1
0
        /// <summary>
        /// Requests the Google calendar authentication.
        /// </summary>
        /// <param name="checkAuth">if set to <c>true</c> [check authentication].</param>
        private async Task RequestGoogleCalendarAuthentication(bool checkAuth = false)
        {
            if (!Enabled || !rbGoogle.Checked)
            {
                return;
            }

            apiResponseLabel.ResetText();
            apiResponseLabel.ResetForeColor();

            if (checkAuth && !GoogleCalendarEvent.HasCredentialsStored())
            {
                return;
            }

            throbber.State   = ThrobberState.Rotating;
            throbber.Visible = true;

            SerializableAPIResult <SerializableAPICredentials> result = await GoogleCalendarEvent.RequestAuth(checkAuth);

            throbber.State   = ThrobberState.Stopped;
            throbber.Visible = false;

            btnRequestAuth.Enabled = result.HasError;
            btnRevokeAuth.Enabled  = tbGoogleCalendarName.Enabled = cbGoogleReminder.Enabled = !result.HasError;

            apiResponseLabel.ForeColor = result.HasError ? Color.Red : Color.Green;
            apiResponseLabel.Text      = result.HasError ? result.Error.ErrorCode ?? result.Error.ErrorMessage : @"Authenticated";
        }
コード例 #2
0
 public override CalendarEvent getThirdpartyCalendarEvent()
 {
     if (ThirdpartyCalendarEventInfo == null)
     {
         ThirdpartyCalendarEventInfo = new GoogleCalendarEvent(IDToCalendarEvent.Values, _User);
     }
     return(ThirdpartyCalendarEventInfo);
 }
コード例 #3
0
    public override void ReceiveDictationResult(string message)
    {
        reactingObject.ReactOnDictationStop();
        dayField.StopCreatingEvent();
        DateTime            start        = new DateTime(dayField.representedDay.Year, dayField.representedDay.Month, dayField.representedDay.Day, hourAllEventsBegin, 0, 0);
        DateTime            end          = new DateTime(dayField.representedDay.Year, dayField.representedDay.Month, dayField.representedDay.Day, hourAllEventsEnd, 0, 0);
        GoogleCalendarEvent createdEvent = new GoogleCalendarEvent(message, start, end);

        googleCalendarWriter.SendEventToCalendar(createdEvent);
    }
コード例 #4
0
ファイル: GoogleCalendarAPI.cs プロジェクト: SyJuly/WorkAR
    public UnityWebRequest InsertCalendarevent(GoogleCalendarEvent eventToInsert)
    {
        string          stringEventToInsert = JsonUtility.ToJson(eventToInsert);
        UnityWebRequest post = new UnityWebRequest(credentials.calendar_endpoint + credentials.calendar_id + "/events?access_token=" + authentificator.gat.access_token + "&t=" + getUTCTime(), "POST");

        byte[] bodyRaw = Encoding.UTF8.GetBytes(stringEventToInsert);
        post.uploadHandler = (UploadHandler) new UploadHandlerRaw(bodyRaw);
        post.SetRequestHeader("Content-Type", "application/json");
        post.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        return(post);
    }
コード例 #5
0
        public async static Task <IEnumerable <CalendarEvent> > getAllCalEvents(IList <Event> AllSubCals, CalendarService CalendarServiceData, string UserID, EventID AuthenticationID, TimeLine CalculationTimeLine, bool retrieveLocationFromGoogle, Location defaultLocation = null)
        {
            List <Event> AllSubCalNoCancels = AllSubCals.Where(obj => obj.Status != "cancelled").ToList();

            Dictionary <string, Event>    RepeatingIDs = new Dictionary <string, Event>();
            DateTimeOffset                now          = DateTimeOffset.UtcNow;
            ConcurrentBag <CalendarEvent> RetValue     = new ConcurrentBag <CalendarEvent>();

            if (CalculationTimeLine == null)
            {
                CalculationTimeLine = new TimeLine(now.AddDays(Utility.defaultBeginDay), now.AddDays(Utility.defaultEndDay));
            }

            ConcurrentBag <TilerElements.Location> locations = new ConcurrentBag <TilerElements.Location>();
            uint i = 0;

            for (; i < AllSubCalNoCancels.Count; i++)
            {
                Event GoogleEvent = AllSubCalNoCancels[(int)i];
                if (GoogleEvent.Start.DateTime != null)
                {
                    TimeLine EventRange = new TimeLine(GoogleEvent.Start.DateTime.Value.ToUniversalTime(), GoogleEvent.End.DateTime.Value.ToUniversalTime());
                    if (EventRange.InterferringTimeLine(CalculationTimeLine) != null || GoogleEvent.Recurrence != null) // took out manual check for repetition because of we set the property singleEvents in  the function getGoogleEvents in class GoogleTilerEventControl.cs. If you need the manual look up run "git checkout 8db3dab166909255ce112" and jump back to this file you should see logic about this below.
                    {
                        GoogleIDs.Add(GoogleEvent.Id);
                        CalendarEvent calEvent = GoogleCalendarEvent.convertFromGoogleToCalendarEvent(GoogleEvent.ToSubCal(AuthenticationID, i));
                        RetValue.Add(calEvent);
                        locations.Add(calEvent.LocationObj);
                        if (defaultLocation != null && (calEvent.LocationObj != null && (calEvent.LocationObj.isNull || calEvent.LocationObj.isDefault)))
                        {
                            calEvent.Location_DB = defaultLocation;
                            foreach (var eachSubEvent in calEvent.AllSubEvents)
                            {
                                eachSubEvent.Location_DB = defaultLocation;
                            }
                        }
                    }
                }
            }

            if (retrieveLocationFromGoogle)
            {
                batchValidateLocations(locations);
            }
            else
            {
                foreach (TilerElements.Location location in locations)
                {
                    location.IsVerified = true;
                }
            }
            return(RetValue);
        }
コード例 #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Session["CustomerId"] != null)
            {
                int      customerid  = Convert.ToInt32(Session["CustomerId"].ToString());
                DataSet  ds          = existing_customerBLL.Instance.GetExistingCustomerDetail(customerid, "", Session["loginid"].ToString());
                int      Id          = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                string   name        = txtCust_name.Text;
                string   strno       = txtCust_strt.Text;
                string   jobloc      = txtJob_loc.Text;
                DateTime estdate     = Convert.ToDateTime(txtEst_date.Text);
                DateTime todaydate   = Convert.ToDateTime(txtToday_date.Text);
                string   ph1         = txtPri_ph.Text;
                string   secph       = txtSec_ph.Text;
                string   mail        = txtEmail.Text;
                string   calltakenby = txtCall_takenby.Text;
                string   service     = txtService.Text;
                string   leadtype;

                if (ddlleadtype.SelectedValue.ToString() == "Other")
                {
                    leadtype = txtleadtype.Text;
                }
                else
                {
                    leadtype = ddlleadtype.SelectedValue.ToString();
                }


                int a = existing_customerBLL.Instance.UpdateCustomer(Id, name, strno, jobloc, estdate, todaydate, ph1, secph, mail, calltakenby, service, leadtype);
                if (a > 0)
                {
                    string userName = ConfigurationManager.AppSettings["AdminCalendarUser"].ToString();
                    string userPwd  = ConfigurationManager.AppSettings["AdminCalendarPwd"].ToString();
                    if (Session["AdminUserId"] == null)
                    {
                        GoogleCalendarEvent.EditEvent(Request.QueryString["title"].ToString(), ("C" + Id.ToString() + "-" + name), name, service, estdate, estdate, Session["loginid"].ToString());
                    }

                    GoogleCalendarEvent.EditEvent(Request.QueryString["title"].ToString(), ("C" + Id.ToString() + "-" + name), name, service, estdate, estdate, userName);
                }
            }
        }
コード例 #7
0
    IEnumerator InsertEvent()
    {
        UnityWebRequest InserEventRequest = calendarAPI.InsertCalendarevent(eventToBeInserted);

        InserEventRequest.timeout = 90000000;
        yield return(InserEventRequest.SendWebRequest());

        if (InserEventRequest.isNetworkError || InserEventRequest.isHttpError)
        {
            if (InserEventRequest.responseCode == 401)
            {
                Debug.Log("Refreshed token");
                calendarAPI.RefreshAccessToken(this);
            }
        }
        else
        {
            eventToBeInserted = null;
        }
    }
コード例 #8
0
        /// <summary>
        /// Handles the Click event of the btnRevokeAuth control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private async void btnRevokeAuth_Click(object sender, EventArgs e)
        {
            apiResponseLabel.ResetText();
            apiResponseLabel.ResetForeColor();

            throbber.State   = ThrobberState.Rotating;
            throbber.Visible = true;

            var result = await GoogleCalendarEvent.RevokeAuth();

            throbber.State   = ThrobberState.Stopped;
            throbber.Visible = false;

            bool error = result.HasError;

            btnRequestAuth.Enabled = !error;
            btnRevokeAuth.Enabled  = tbGoogleCalendarName.Enabled = cbGoogleReminder.Enabled =
                error;
            if (error)
            {
                apiResponseLabel.ForeColor = Color.Red;
                apiResponseLabel.Text      = result.Error.ErrorMessage;
            }
        }
コード例 #9
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            Button       btnsave          = sender as Button;
            GridViewRow  gr               = (GridViewRow)btnsave.Parent.Parent;
            LinkButton   lnkid            = (LinkButton)gr.FindControl("lnkcustomerid");
            DropDownList ddlstatus        = (DropDownList)gr.FindControl("ddlmeetingstatus");
            TextBox      txtfollowup      = (TextBox)gr.FindControl("txtfollowup");
            HiddenField  hdffollowupdate  = (HiddenField)gr.FindControl("hdffollowupdate");
            HiddenField  hdfmeetingstatus = (HiddenField)gr.FindControl("hdfmeetingstatus");
            string       followupdate     = string.IsNullOrEmpty(txtfollowup.Text) ? "1/1/1753" : Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE).ToString("MM/dd/yyyy");
            string       type             = lnkid.Text.Substring(0, 1);
            string       id               = lnkid.Text.Substring(1);
            int          custid           = Convert.ToInt32(id);
            string       oldstatus        = hdfmeetingstatus.Value;
            string       newstatus        = ddlstatus.SelectedValue;
            bool         updateresult     = false;
            string       AdminId          = ConfigurationManager.AppSettings["AdminUserId"].ToString();
            string       Adminuser        = ConfigurationManager.AppSettings["AdminCalendarUser"].ToString();
            string       AdminPwd         = ConfigurationManager.AppSettings["AdminCalendarPwd"].ToString();

            Customer c = new Customer();

            c = new_customerBLL.Instance.fetchcustomer(custid);
            string productName = UserBLL.Instance.GetProductNameByProductId(c.Productofinterest);

            if (newstatus == "Set")
            {
                if (type == "C")
                {
                    Response.Redirect("~/Sr_App/Customer_Profile.aspx?title=" + id);
                }
                else if (type == "P")
                {
                    Response.Redirect("~/Prospectmaster.aspx?title=" + id);
                }
            }

            //commented for phase I, Applicable in phase II

            //else if ((oldstatus == "Prospect" || oldstatus == "Follow up" || oldstatus == "Rehash" || oldstatus == "cancelation-no rehash") && (newstatus == "PTW est" || newstatus == "est>$1000" || newstatus == "est<$1000" || newstatus == "EST-one legger" || newstatus == "sold>$1000" || newstatus == "sold<$1000" || newstatus == "Closed (not sold)" || newstatus == "Closed (sold)"))
            //{
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Cannot change prospect to estimate or sold');", true);
            //    return;
            //}
            else if (newstatus == "Prospect" || newstatus == "Follow up" || newstatus == "Rehash" || newstatus == "cancelation-no rehash")
            {
                if (AdminId != c.Addedby)
                {
                    GoogleCalendarEvent.DeleteEvent(id, "", "", "", DateTime.Now, DateTime.Now, c.Addedby);
                }
                GoogleCalendarEvent.DeleteEvent(id, "", "", "", DateTime.Now, DateTime.Now, AdminId);
                GoogleCalendarEvent.DeleteEvent(id, "", "", "", DateTime.Now, DateTime.Now, JGConstant.CustomerCalendar);
            }
            else if (newstatus == "PTW est" || newstatus == "est>$1000" || newstatus == "est<$1000" || newstatus == "EST-one legger" || newstatus == "Closed (not sold)" || newstatus == "sold>$1000" || newstatus == "sold<$1000")
            {
                string gtitle   = c.EstTime + " -" + c.PrimaryContact + " -" + c.Addedby;
                string gcontent = "Name: " + c.customerNm + " , Product of Interest: " + productName + ", Phone: " + c.CellPh + ", Alt. phone: " + c.AltPh + ", Email: " + c.Email + ",Notes: " + c.Notes + ",Status: " + newstatus;
                string gaddress = c.CustomerAddress + "," + c.City;
                string datetime = null;
                if (c.EstDate != "1/1/1753")
                {
                    datetime = Convert.ToDateTime(c.EstDate + " " + c.EstTime).ToString("MM/dd/yy hh:mm tt");
                }
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), AdminId);
                GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), AdminId);
                if (AdminId != c.Addedby)
                {
                    GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), c.Addedby);
                    GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), c.Addedby);
                }
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), JGConstant.CustomerCalendar);
                GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), JGConstant.CustomerCalendar);
            }

            //commented for phase I, Applicable in phase II

            //else if (newstatus == "sold>$1000" || newstatus == "sold<$1000")
            //{
            //    Session["CustomerId"] = custid;
            //    Session["CustomerName"] = c.customerNm;
            //    Response.Redirect("~/Sr_App/ProductEstimate.aspx");
            //}

            try
            {
                updateresult = AdminBLL.Instance.UpdateStatus(custid, newstatus, followupdate);
                int userId = Convert.ToInt16(Session[JG_Prospect.Common.SessionKey.Key.UserId.ToString()]);
                new_customerBLL.Instance.AddCustomerFollowUp(custid, Convert.ToDateTime(followupdate), newstatus, userId, false, 0, "");
            }

            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('" + ex.Message + "');", true);
            }
            //bindgrid();
        }
コード例 #10
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            btn_UploadFiles_Click(sender, e);
            objuser.username = txtusername.Text;
            objuser.loginid  = txtloginid.Text;
            objuser.email    = txtemail.Text.Trim();
            objuser.address  = txtaddress.Text;
            objuser.password = txtpassword.Text;
            objuser.usertype = ddlusertype.SelectedValue;
            //objuser.designation = ddldesignation.SelectedValue;
            objuser.designation   = null;
            objuser.status        = ddlstatus.SelectedValue;
            objuser.phone         = txtphone.Text;
            objuser.fristname     = txtfristname.Text;
            objuser.lastname      = txtlastname.Text;
            objuser.zip           = txtZip.Text;
            objuser.state         = txtState.Text;
            objuser.city          = txtCity.Text;
            objuser.businessname  = txtbusinessname.Text;
            objuser.ssn           = txtssn.Text;
            objuser.ssn1          = txtssn0.Text;
            objuser.ssn2          = txtssn1.Text;
            objuser.signature     = txtSignature.Text;
            objuser.dob           = DOBdatepicker.Text;
            objuser.citizenship   = ddlcitizen.SelectedValue;
            objuser.tin           = txtTIN.Text;
            objuser.ein1          = txtEIN.Text;
            objuser.ein2          = txtEIN2.Text;
            objuser.maritalstatus = ddlMaritalstatus.SelectedValue;
            objuser.a             = txtA.Text;
            objuser.b             = txtB.Text;
            objuser.c             = txtC.Text;
            objuser.d             = txtD.Text;
            objuser.e             = txtE.Text;
            objuser.f             = txtF.Text;
            objuser.g             = txtG.Text;
            objuser.h             = txtH.Text;
            objuser.i             = txt5.Text;
            objuser.j             = txt6.Text;
            objuser.k             = txt7.Text;
            //lblName.Text = ViewState["FristName"].ToString() + ViewState["LastName"].ToString();
            if (lstboxUploadedImages.Items.Count != 0)
            {
                foreach (System.Web.UI.WebControls.ListItem img in lstboxUploadedImages.Items)
                {
                    fn = fn + "," + img.Text;
                }
                objuser.picture = fn.TrimStart(',');
            }
            else if (lstboxUploadedImages.Items.Count > 0)
            {
                foreach (System.Web.UI.WebControls.ListItem img in lstboxUploadedImages.Items)
                {
                    fn = fn + "," + img.Text;
                }
                objuser.picture = fn.TrimStart(',');
            }
            else
            {
                objuser.picture = "";
            }

            objuser.attachements = GetUpdateAttachments();
            int  id     = Convert.ToInt32(Session["ID"]);
            bool result = UserBLL.Instance.UpdatingUser(objuser, id);

            GoogleCalendarEvent.CreateCalendar(txtemail.Text, txtaddress.Text);
            lblmsg.Visible  = true;
            lblmsg.CssClass = "success";
            lblmsg.Text     = "User Details Updated  successfully";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('User  Update successfully');", true);
            clearcontrols();
            Server.Transfer("EditUser.aspx");
        }
コード例 #11
0
        protected void btncreate_Click(object sender, EventArgs e)
        {
            try
            {
                btn_UploadFiles_Click(sender, e);

                if (ddlstatus.SelectedIndex <= 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Please Select Status');", true);
                    return;
                }
                else
                {
                    objuser.status = ddlstatus.SelectedValue;
                }

                if (ddlusertype.SelectedIndex <= 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Please Select User Type');", true);
                    return;
                }
                else
                {
                    objuser.usertype = ddlusertype.SelectedValue;
                }
                objuser.username     = txtusername.Text;
                objuser.loginid      = txtloginid.Text.Trim();
                objuser.email        = txtemail.Text.Trim();
                objuser.password     = txtpassword.Text;
                objuser.designation  = null;
                objuser.phone        = txtphone.Text;
                objuser.address      = txtaddress.Text;
                ViewState["address"] = txtaddress.Text;
                objuser.fristname    = txtfristname.Text;
                objuser.lastname     = txtlastname.Text;
                objuser.zip          = txtZip.Text;
                objuser.state        = txtState.Text;
                objuser.city         = txtCity.Text;
                objuser.businessname = txtbusinessname.Text;
                objuser.ssn          = txtssn.Text;
                objuser.ssn1         = txtssn0.Text;
                objuser.ssn2         = txtssn1.Text;
                string ssn = txtssn.Text + "-" + txtssn0.Text + "-" + txtssn1.Text;
                ViewState[ssn]        = ssn;
                objuser.signature     = txtSignature.Text;
                objuser.dob           = DOBdatepicker.Text;
                objuser.citizenship   = ddlcitizen.SelectedValue;
                objuser.tin           = txtTIN.Text;
                objuser.ein1          = txtEIN.Text;
                objuser.ein2          = txtEIN2.Text;
                objuser.maritalstatus = ddlMaritalstatus.SelectedValue;
                objuser.a             = txtA.Text;
                objuser.b             = txtB.Text;
                objuser.c             = txtC.Text;
                objuser.d             = txtD.Text;
                objuser.e             = txtE.Text;
                objuser.f             = txtF.Text;
                objuser.g             = txtG.Text;
                objuser.h             = txtH.Text;
                objuser.i             = txt5.Text;
                objuser.j             = txt6.Text;
                objuser.k             = txt7.Text;
                // lblName.Text = ViewState["FristName"].ToString() + ViewState["LastName"].ToString();
                if (flpUplaodPicture.FileName != string.Empty)
                {
                    foreach (System.Web.UI.WebControls.ListItem img in lstboxUploadedImages.Items)
                    {
                        fn = fn + "," + img.Text;
                    }
                    Server.MapPath("~/UserImages" + "\\" + flpUplaodPicture.FileName);
                    objuser.picture = fn.TrimStart(',');
                }
                else if (lstboxUploadedImages.Items.Count > 0)
                {
                    foreach (System.Web.UI.WebControls.ListItem img in lstboxUploadedImages.Items)
                    {
                        fn = fn + "," + img.Text;
                    }
                    objuser.picture = fn.TrimStart(',');
                }
                else
                {
                    objuser.picture = string.Empty;
                }
                string strFileName = string.Empty;
                if (ViewState["FileName"] != null)
                {
                    strFileName          = ViewState["FileName"].ToString();
                    strFileName          = strFileName.TrimStart(',');
                    objuser.attachements = strFileName;
                }
                else
                {
                    objuser.attachements = strFileName;
                }
                bool result = UserBLL.Instance.AddUser(objuser);
                if (result)
                {
                    lblmsg.CssClass = "success";
                    lblmsg.Text     = "User has been created successfully";
                    lblmsg.Visible  = true;
                    clearcontrols();
                    GoogleCalendarEvent.CreateCalendar(txtemail.Text, txtaddress.Text);
                    shareCalender(txtemail.Text);
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('User has been created successfully');", true);
                    clearcontrols();
                }
                else
                {
                    lblmsg.Visible  = true;
                    lblmsg.CssClass = "error";
                    lblmsg.Text     = "User with this email id already exist";
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Instance.writeToLog(ex, "CreateUser", "");
                //LogManager.Instance.WriteToFlatFile(ex.Message, "Custom",1);// Request.ServerVariables["remote_addr"].ToString());
            }
        }
コード例 #12
0
        // protected void btnsave_Click(object sender, EventArgs e)
        protected void AutoSave(object sender, EventArgs e, string control)
        {
            try
            {
                //Button btnsave = sender as Button;
                //GridViewRow gr = (GridViewRow)btnsave.Parent.Parent;
                GridViewRow gr = null;
                if (control == JGConstant.DROPDOWNLIST)
                {
                    DropDownList ddlmeetingstatus = sender as DropDownList;
                    gr = (GridViewRow)ddlmeetingstatus.Parent.Parent;
                }
                else if (control == JGConstant.TEXTBOX)
                {
                    TextBox txtfollow = sender as TextBox;
                    gr = (GridViewRow)txtfollow.Parent.Parent;
                }
                LinkButton   lnkid           = (LinkButton)gr.FindControl("lnkestimateid");
                DropDownList ddlstatus       = (DropDownList)gr.FindControl("ddlmeetingstatus");
                TextBox      txtfollowup     = (TextBox)gr.FindControl("txtfollowup");
                HiddenField  hdffollowupdate = (HiddenField)gr.FindControl("hdffollowupdate");
                string       AdminId         = ConfigurationManager.AppSettings["AdminUserId"].ToString();
                DateTime     followupdate    = (txtfollowup.Text != "") ? Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE) : DateTime.MinValue;
                string       followDate      = string.IsNullOrEmpty(txtfollowup.Text) ? "1/1/1753" : Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE).ToString("MM/dd/yyyy");
                string       newstatus       = ddlstatus.SelectedItem.Text;
                if (newstatus == "Set")
                {
                    followDate = "1/1/1753";
                    AdminBLL.Instance.UpdateStatus(Convert.ToInt32(lnkid.Text), newstatus, followDate);
                    //Server.Transfer("~/Prospectmaster.aspx?title=" + lnkid.Text);
                    Session[SessionKey.Key.PreviousPage.ToString()] = JGConstant.PAGE_STATIC_REPORT;
                    Response.Redirect("~/Prospectmaster.aspx?title=" + lnkid.Text);
                }
                else if (newstatus == "Follow up")
                {
                    txtfollowup.Visible = true;
                    //if (hdffollowupdate.Value != "")
                    //{
                    //    followupdate = Convert.ToDateTime(hdffollowupdate.Value, JGConstant.CULTURE);
                    //    txtfollowup.Text = hdffollowupdate.Value;

                    //}
                    //else
                    //{
                    //    txtfollowup.Text = "";
                    //    followupdate = DateTime.MinValue;
                    //}
                    if (txtfollowup.Text == "")
                    {
                        followupdate     = Convert.ToDateTime(hdffollowupdate.Value, JGConstant.CULTURE);
                        txtfollowup.Text = hdffollowupdate.Value;
                        followDate       = string.IsNullOrEmpty(txtfollowup.Text) ? "1/1/1753" : Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE).ToString("MM/dd/yyyy");
                    }
                    UserBLL.Instance.updateProspectstatus(Convert.ToInt32(lnkid.Text), newstatus, followupdate);
                    GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, AdminId);
                    GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, JGConstant.CustomerCalendar);
                    if (LoginSession != AdminId)
                    {
                        GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, LoginSession);
                    }
                }
                else if (newstatus == "Prospect" || newstatus == "Rehash" || newstatus == "cancelation-no rehash")
                {
                    GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, AdminId);
                    GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, JGConstant.CustomerCalendar);
                    if (LoginSession != AdminId)
                    {
                        GoogleCalendarEvent.DeleteEvent(lnkid.Text, "", "", "", DateTime.Now, DateTime.Now, LoginSession);
                    }
                }
                else
                {
                    txtfollowup.Visible = false;
                }
                AdminBLL.Instance.UpdateStatus(Convert.ToInt32(lnkid.Text), newstatus, followDate);
                int userId = Convert.ToInt16(Session[JG_Prospect.Common.SessionKey.Key.UserId.ToString()].ToString());
                new_customerBLL.Instance.AddCustomerFollowUp(Convert.ToInt32(lnkid.Text), Convert.ToDateTime(followupdate), newstatus, userId, false, 0);
                // ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Saved Successfully');", true);
                bindgrid("onload");
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('There is some error in Saving');", true);
            }
        }
コード例 #13
0
 public void SendEventToCalendar(GoogleCalendarEvent eventToInsert)
 {
     eventToBeInserted = eventToInsert;
     Utility.Instance.StartCoroutine(InsertEvent());
 }
コード例 #14
0
        protected void Save_Click(object sender, EventArgs e)
        {
            int result = 0;


            foreach (GridViewRow dr in grddata.Rows)
            {
                foreach (TableCell c in dr.Cells)
                {
                    if (c.Text == "&nbsp;")
                    {
                        c.Text = "";
                    }
                }

                string[] date_time         = (dr.Cells[1].Text).Split('-');
                string   CustomerNm        = dr.Cells[2].Text + " " + dr.Cells[3].Text;
                string   CellPh            = dr.Cells[4].Text;
                string   AltPh             = dr.Cells[5].Text;
                string   HomePh            = dr.Cells[6].Text;
                string   Email             = dr.Cells[7].Text;
                string   Address           = dr.Cells[8].Text;
                string[] CityStateZip      = dr.Cells[9].Text.Split(',');
                string   followupstatus    = dr.Cells[10].Text;
                string   followupdate      = dr.Cells[11].Text;
                string   Productofinterest = dr.Cells[12].Text;
                string   Besttimeofcontact = dr.Cells[13].Text;
                string   meetingstatus     = dr.Cells[14].Text;
                string   CallTakenBy       = dr.Cells[15].Text;
                string   Notes             = dr.Cells[16].Text;
                string   primarycontact    = dr.Cells[17].Text;
                string   ContactPreference = dr.Cells[18].Text;
                string   BillingAddress    = dr.Cells[19].Text;
                string   JobLocation       = dr.Cells[20].Text;
                string   LeadType          = dr.Cells[21].Text;
                string   AssignedTo        = dr.Cells[22].Text;
                string   Reasonofclose     = dr.Cells[23].Text;

                Customer objcust = new Customer();
                objcust.missingcontacts = 0;

                if (CellPh == "0" || CellPh == "")
                {
                    objcust.missingcontacts++;
                }
                if (AltPh == "0" || AltPh == "")
                {
                    objcust.missingcontacts++;
                }
                if (HomePh == "0" || HomePh == "")
                {
                    objcust.missingcontacts++;
                }


                if (objcust.missingcontacts > 2)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Please Fill atleast one contact(Cell Phone, Home Phone or Alt. Phone');", true);
                    return;
                }

                int primarycont = new_customerBLL.Instance.Searchprimarycontact(HomePh, CellPh, AltPh, 0);
                if (primarycont == 1)
                {
                    objcust.Isrepeated = false;
                }
                else
                {
                    objcust.Isrepeated = true;
                }

                objcust.EstDate         = (date_time != null) ? date_time[0].ToString() : "1/1/1753";
                objcust.EstTime         = (date_time != null) ? date_time[1].ToString() : "";
                objcust.customerNm      = CustomerNm;
                objcust.CellPh          = CellPh;
                objcust.AltPh           = AltPh;
                objcust.HousePh         = HomePh;
                objcust.Email           = Email;
                objcust.CustomerAddress = Address;
                objcust.City            = CityStateZip[0].ToString();
                objcust.state           = CityStateZip[1].ToString();
                objcust.Zipcode         = CityStateZip[2].ToString();
                objcust.followupdate    = followupdate != "" ? followupdate : "1/1/1753";
                int productId = UserBLL.Instance.GetProductIDByProductName(Productofinterest);
                objcust.Productofinterest = productId;
                objcust.BestTimetocontact = Besttimeofcontact;
                objcust.status            = meetingstatus;
                objcust.CallTakenby       = CallTakenBy;
                objcust.Notes             = Notes;
                objcust.PrimaryContact    = primarycontact;
                objcust.ContactPreference = ContactPreference;
                if (BillingAddress == "same")
                {
                    objcust.BillingAddress = objcust.CustomerAddress + "," + objcust.City + "," + objcust.state + "," + objcust.Zipcode;
                }
                objcust.JobLocation = JobLocation;
                objcust.Leadtype    = CallTakenBy;
                objcust.Addedby     = CallTakenBy;
                objcust.CallTakenby = CallTakenBy;

                objcust.Map1 = objcust.customerNm + "-" + Guid.NewGuid().ToString().Substring(0, 5) + ".Jpeg";
                objcust.Map2 = objcust.customerNm + "-" + "Direction" + Guid.NewGuid().ToString().Substring(0, 5) + ".Jpeg";
                string DestinationPath = Server.MapPath("~/CustomerDocs/Maps/");
                new_customerBLL.Instance.SaveMapImage(objcust.Map1, objcust.CustomerAddress, objcust.City, objcust.state, objcust.Zipcode, DestinationPath);
                new_customerBLL.Instance.SaveMapImageDirection(objcust.Map2, objcust.CustomerAddress, objcust.City, objcust.state, objcust.Zipcode, DestinationPath);


                result = new_customerBLL.Instance.AddCustomer(objcust);

                if (primarycontact == "Cell Phone")
                {
                }

                string date = Convert.ToDateTime(objcust.EstDate).ToShortDateString();
                string datetime;


                if (date != "1/1/1753")
                {
                    datetime = Convert.ToDateTime(date + " " + objcust.EstTime).ToString("MM/dd/yy hh:mm tt");
                }
                else
                {
                    datetime = Convert.ToDateTime(objcust.followupdate).ToString("MM/dd/yy hh:mm tt");
                }

                if (result > 0)
                {
                    string AdminId   = ConfigurationManager.AppSettings["AdminUserId"].ToString();
                    string Adminuser = ConfigurationManager.AppSettings["AdminCalendarUser"].ToString();
                    string AdminPwd  = ConfigurationManager.AppSettings["AdminCalendarPwd"].ToString();
                    if (meetingstatus == "Set")
                    {
                        string gtitle   = objcust.EstTime + " -" + primarycontact + " -" + objcust.CallTakenby;
                        string gcontent = "Name: " + objcust.customerNm + " ,Product of Interest: " + Productofinterest + ", Phone: " + objcust.CellPh + ", Alt. phone: " + objcust.AltPh + ", Email: " + objcust.Email + ",Notes: " + objcust.Notes + ",Status: " + objcust.status;
                        string gaddress = objcust.CustomerAddress + " " + objcust.City + "," + objcust.state + "," + objcust.Zipcode;

                        if (CallTakenBy != AdminId)
                        {
                            GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), result.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), CallTakenBy);
                        }
                        GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), result.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), AdminId);

                        gtitle   = objcust.EstTime + " -" + primarycontact + " -" + Session["loginid"].ToString();
                        gcontent = "Name: " + objcust.customerNm + " , Cell Phone: " + objcust.CellPh + ", Alt. phone: " + objcust.AltPh + ", Email: " + objcust.Email + ",Service: " + objcust.Notes + ",Status: " + objcust.status;
                        gaddress = Address + " " + objcust.City + "," + objcust.state + " -" + objcust.Zipcode;
                        GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), result.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime), Convert.ToDateTime(datetime).AddHours(1), JGConstant.CustomerCalendar);
                    }

                    AdminBLL.Instance.UpdateStatus(result, meetingstatus, objcust.followupdate);
                    int userId = Convert.ToInt16(Session[JG_Prospect.Common.SessionKey.Key.UserId.ToString()].ToString());
                    new_customerBLL.Instance.AddCustomerFollowUp(result, Convert.ToDateTime(objcust.followupdate), meetingstatus, userId, false, 0, "");

                    lblmsg.Visible  = true;
                    lblmsg.CssClass = "success";
                    lblmsg.Text     = "Data has been saved successfully";
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('Data has been saved successfully');", true);
                }
                else
                {
                    lblmsg.Visible  = true;
                    lblmsg.CssClass = "error";
                    lblmsg.Text     = "There is some error in adding the Prospect";
                }
            }
        }
コード例 #15
0
        // protected void btnsave_Click(object sender, EventArgs e)
        protected void AutoSave(object sender, EventArgs e, string control)
        {
            // Button btnsave = sender as Button;
            GridViewRow gr = null;

            if (control == JGConstant.DROPDOWNLIST)
            {
                DropDownList ddlmeetingstatus = sender as DropDownList;
                gr = (GridViewRow)ddlmeetingstatus.Parent.Parent;
            }
            else if (control == JGConstant.TEXTBOX)
            {
                TextBox txtfollow = sender as TextBox;
                gr = (GridViewRow)txtfollow.Parent.Parent;
            }
            //GridViewRow gr = (GridViewRow)btnsave.Parent.Parent;
            LinkButton   lnkid           = (LinkButton)gr.FindControl("lnkcustomerid");
            TextBox      txtfollowup     = (TextBox)gr.FindControl("txtfollowup");
            HiddenField  hdffollowupdate = (HiddenField)gr.FindControl("hdffollowupdate");
            DropDownList ddlstatus       = (DropDownList)gr.FindControl("ddlmeetingstatus");
            DateTime     followupdate    = (txtfollowup.Text != "") ? Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE) : DateTime.Now.AddDays(7);
            string       followDate      = string.IsNullOrEmpty(txtfollowup.Text) ? DateTime.Now.AddDays(7).ToString("MM/dd/yyyy") : Convert.ToDateTime(txtfollowup.Text, JGConstant.CULTURE).ToString("MM/dd/yyyy");
            int          custid          = Convert.ToInt32(lnkid.Text);
            string       newstatus       = ddlstatus.SelectedItem.Text;
            string       AdminId         = ConfigurationManager.AppSettings["AdminUserId"].ToString();
            string       Adminuser       = ConfigurationManager.AppSettings["AdminCalendarUser"].ToString();
            string       AdminPwd        = ConfigurationManager.AppSettings["AdminCalendarPwd"].ToString();
            Customer     c = new Customer();

            c = new_customerBLL.Instance.fetchcustomer(custid);
            string productName = UserBLL.Instance.GetProductNameByProductId(c.Productofinterest);

            if (ddlstatus.SelectedValue == "Set")
            {
                Response.Redirect("~/Sr_App/Customer_Profile.aspx?title=" + lnkid.Text);
            }
            else if (newstatus == "Rehash" || newstatus == "cancelation-no rehash")
            {
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), "", "", "", DateTime.Now, DateTime.Now, AdminId);
                if (AdminId != c.Addedby)
                {
                    GoogleCalendarEvent.DeleteEvent(custid.ToString(), "", "", "", DateTime.Now, DateTime.Now, c.Addedby);
                }
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), "", "", "", DateTime.Now, DateTime.Now, JGConstant.CustomerCalendar);
            }
            if (newstatus == "est>$1000" || newstatus == "est<$1000")
            {
                string gtitle   = c.EstTime + " -" + c.PrimaryContact + " -" + c.Addedby;
                string gcontent = "Name: " + c.customerNm + " , Product of Interest: " + productName + ", Phone: " + c.CellPh + ", Alt. phone: " + c.AltPh + ", Email: " + c.Email + ",Notes: " + c.Notes + ",Status: " + newstatus;
                string gaddress = c.CustomerAddress + "," + c.City;
                string datetime = null;
                if (c.EstDate != "1/1/1753")
                {
                    if (c.EstDate != "")
                    {
                        if (c.EstDate != null)
                        {
                            datetime = Convert.ToDateTime(c.EstDate + " " + c.EstTime).ToString("MM/dd/yy hh:mm tt");
                        }
                    }
                }
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), AdminId);
                GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), AdminId);
                if (AdminId != c.Addedby)
                {
                    GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), c.Addedby);
                    GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), c.Addedby);
                }
                GoogleCalendarEvent.DeleteEvent(custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), JGConstant.CustomerCalendar);
                GoogleCalendarEvent.AddEvent(GoogleCalendarEvent.GetService("GoogleCalendar", Adminuser, AdminPwd), custid.ToString(), gtitle, gcontent, gaddress, Convert.ToDateTime(datetime, JGConstant.CULTURE), Convert.ToDateTime(datetime, JGConstant.CULTURE).AddHours(1), JGConstant.CustomerCalendar);
            }

            else if (newstatus == "sold>$1000" || newstatus == "sold<$1000")
            {
                Session["CustomerId"]   = custid;
                Session["CustomerName"] = c.customerNm;
                Response.Redirect("~/Sr_App/ProductEstimate.aspx");
            }
            else if (newstatus == "Closed (not sold)")
            {
                // save reason of closed
            }

            //foreach (ListItem item in ddlstatus.Items)
            //{
            //    ListItem i = ddlstatus.Items.FindByValue(item.Value);
            //    if (i.Text == "est>$1000" || i.Text == "est<$1000" || i.Text == "sold>$1000" || i.Text == "sold<$1000")
            //    {
            //        i.Attributes.Add("style", "color:gray;");
            //        i.Attributes.Add("disabled", "true");
            //        i.Value = "-1";
            //    }
            //}
            int userId = Convert.ToInt16(Session[JG_Prospect.Common.SessionKey.Key.UserId.ToString()].ToString());

            AdminBLL.Instance.UpdateStatus(custid, ddlstatus.SelectedItem.Text, followDate);
            new_customerBLL.Instance.AddCustomerFollowUp(custid, Convert.ToDateTime(followupdate), ddlstatus.SelectedItem.Text, userId, false, 0);
            bindgrid("onload");
        }