void SetDocDuration() { if (time.Text == "0") { return; //Revised OM Manual } BLL_Dml _objbll = new BLL_Dml(); _database _objdb = new _database(); _objdb.DBName = "dbCML"; _clsdocduration _objcls = new _clsdocduration(); //string _Doc_type = drpmanufacture.SelectedItem.Value.Substring(0, drpmanufacture.SelectedItem.Value.IndexOf("_T")); string _Doc_type = (string)Session["folder"]; _objcls.Folder_id = Convert.ToInt32(_Doc_type); _objcls.Duration = Convert.ToInt32(time.Text); _objcls.First = Convert.ToInt32(remind1.Text); _objcls.Second = Convert.ToInt32(remind2.Text); _objcls.Third = Convert.ToInt32(remind3.Text); _objcls.prj_code = (string)Session["project"]; _objbll.SetDocDuration(_objcls, _objdb); }
private void SendReminder(string _project) { publicCls.publicCls _obj1 = new publicCls.publicCls(); _obj1.Load_doc_dur(); DateTime _today = DateTime.Now; BLL_Dml _objbll = new BLL_Dml(); _database _objdb = new _database(); _objdb.DBName = "dbCML"; _clsdocduration _obj = new _clsdocduration(); var _result = from o in publicCls.publicCls._dtdocdur.AsEnumerable() where o.Field <string>(9) == _project select o; //int count = 1; foreach (var row in _result) { //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('yES');", true); //return; DateTime _upload = Convert.ToDateTime(row[4].ToString()); TimeSpan _Diff = _today.Subtract(_upload); //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('"+ _Diff.Days.ToString() + row[6].ToString() +"');", true); //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('" + + "');", true); int _srv = Convert.ToInt32(row[13].ToString()); _obj.Folder_id = Convert.ToInt32(row[11].ToString()); if (_Diff.Days.ToString() == row[6].ToString()) { //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('" + _Diff.Days.ToString() + row[12].ToString() + "');", true); //if (count > 3) return; //count += 1; if (row[12].ToString() != "1") { if (row[6].ToString() != "0") { _obj.Remind = 1; int _days = Convert.ToInt32(row[5].ToString()) - Convert.ToInt32(row[6].ToString()); SendRem(row[5].ToString(), _days.ToString(), row[10].ToString(), row[2].ToString(), "First Reminder", _srv); _objbll.Set_Reminder(_obj, _objdb); } } } else if (_Diff.Days.ToString() == row[7].ToString()) { if (row[12].ToString() != "2") { if (row[7].ToString() != "0") { _obj.Remind = 2; int _days = Convert.ToInt32(row[5].ToString()) - Convert.ToInt32(row[7].ToString()); //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('" + row[7].ToString() + "');", true); SendRem(row[5].ToString(), _days.ToString(), row[10].ToString(), row[2].ToString(), "Second Reminder", _srv); _objbll.Set_Reminder(_obj, _objdb); } } } else if (_Diff.Days.ToString() == row[8].ToString()) { if (row[12].ToString() != "3") { if (row[8].ToString() != "0") { _obj.Remind = 3; int _days = Convert.ToInt32(row[5].ToString()) - Convert.ToInt32(row[8].ToString()); //ScriptManager.RegisterStartupScript(this, typeof(string), "close", "alert('" + _Diff.Days.ToString() + "');", true); if (_days > 0) { SendRem(row[5].ToString(), _days.ToString(), row[10].ToString(), row[2].ToString(), "Third Reminder", _srv); _objbll.Set_Reminder(_obj, _objdb); } else { SendCon(row[5].ToString(), row[10].ToString(), row[2].ToString(), Convert.ToInt32(row[0].ToString()), _srv); } } } } else if (_Diff.Days >= Convert.ToInt32(row[5].ToString())) { SendCon(row[5].ToString(), row[10].ToString(), row[2].ToString(), Convert.ToInt32(row[0].ToString()), _srv); } } }