Example #1
0
    //保存评论
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strSql  = "";
        string strSql1 = "";

        strSql = string.Format(@"
    INSERT INTO [OA_Comment]
           ([id]
           ,[head_id]
           ,[user_id]
           ,[time]
           ,[content])
     VALUES
           (
		    '{0}'--<id, varchar(50),>
           ,'{1}'--,<head_id, varchar(50),>
           ,'{2}'--,<user_id, varchar(50),>
           ,'{3}'--,<time, datetime,>
           ,'{4}'--,<content, text,>
		   )
        ", Guid.NewGuid().ToString(), this.KeyId.Value, base.UserCode.ToString(), DateTime.Now, this.comment_content.Text);


        using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql);
                string strs = RYinfo(this.KeyId.Value);
                if (!string.IsNullOrEmpty(strs))
                {
                    strSql1 = @"INSERT INTO [OA_Task_Append]
           ([id]
           ,[task_id]
           ,[user_id]
           --,[look_time]
           --,[progress]
           --,[remark]
           ,[user_type]
           ,[up_time]
		   )
            VALUES " + strs;
                    SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql1);
                }
                sqlTransaction.Commit();
                //发送微信消息
                WXAPI.sendWeChatMsg(UserCode.ToString(), "", hfldCopyto.Value.ToString(), "taskPL", this.KeyId.Value, title.Text.ToString(), create_date.Text.ToString());

                base.RegisterScriptRefresh();
            }
            catch (Exception ex)
            {
                sqlTransaction.Rollback();
                base.RegisterScript("alert('系统提示:\\n\\保存失败!" + ex.Message.ToString() + "');");
            }
        }
    }
Example #2
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            // Assign new action if action is empty or view
            if (Action == string.Empty || Action == Constants.ViewAction)
            {
                Action = Constants.InsertAction;
            }
            if (UserLoginId == string.Empty)
            {
                return;
            }
            if (UserContext == null)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Profile Creation", "Error : Error occured while creating New User Profile", new Exception("UserContext is null"));
                return;
            }
            QueryArgument queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                FilterKey = Action == Constants.InsertAction ? string.Empty : UserCode.ToString(),
                filter1   = UserLoginId,
                QueryType = Constants.ProfileValidationType
            };
            var result = _transactionManager.ValidateKey(queryArgument);

            if (result)
            {
                CustomMessageControl.MessageBodyText = "Duplicate User ID";
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                txtUserId.Focus();
                return;
            }
            if (UpdateUserDetails())
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE SAVED",
                                  GlobalCustomResource.UserProfileSaved, true);
                ClearForm();
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE UPDATE FAILED",
                                  GlobalCustomResource.UserProfileFailed, true);
            }
        }
Example #3
0
        /// <summary>
        /// This method checked the user name and appends necessary item to the code if required
        /// </summary>
        private void SetUserNameField()
        {
            string UserName = txt_UserName.Text.ToString().Trim();
            string UserCode;

            if (UserName.Length > 4)
            {
                if (UserName.Substring(0, 4).ToString().ToUpper() == "MLFL")
                {
                    UserCode = UserName.Substring(4);
                }
                else
                {
                    UserCode = UserName;
                }
                int TempUser1;
                try
                {
                    TempUser1         = int.Parse(UserCode);
                    txt_UserName.Text = string.Format(UserCode.ToString(), "######");
                }
                catch
                {
                }
            }
            else
            {
                if (UserName.Length > 0)
                {
                    int TempUser;
                    try
                    {
                        TempUser          = int.Parse(UserName);
                        txt_UserName.Text = string.Format(TempUser.ToString(), "######");
                    }
                    catch
                    {
                    }
                }
            }
        }
Example #4
0
    private void BindData()
    {
        string    str      = "";
        string    strPoint = "";
        string    strSql   = " select [Id],[doc_Id],[doc_name],[name],[user_Id],v_xm,[sign_x],[sign_y],[remark],[if_del],[sign_time] from OA_File_Sign left join PT_yhmc on PT_yhmc.v_yhdm=user_Id  where doc_Id='" + doc_Id + "' and doc_name='" + doc_name + "' and if_del=0 " + strWhere() + " order by user_Id desc,sign_time desc";
        DataTable dt       = publicDbOpClass.DataTableQuary(strSql);

        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["user_Id"].ToString() == UserCode.ToString())
                {
                    // str += "<li id='li"+ dr["id"] + "' data-option='x:"+dr["sign_x"] +",y:"+ dr["sign_y"] + ",id:"+ dr["id"] + "'><input type='text' id='title" + dr["id"] + "'  value='" + dr["name"] + "' style='width:120px;' readonly /><input type='hidden'  id='remark" + dr["id"] + "'  value=' ' style='width:180px;'/><input type='hidden'  id='x" + dr["id"] + "'  value='" + dr["sign_x"] + "' style='width:50px;'/><input type='hidden'  id='y" + dr["id"] + "'  value='" + dr["sign_y"] + "' style='width:50px;'/>&nbsp;<a href=\"javascript:signInfoEdit('" + dr["id"] + "')\">编辑</a>&nbsp;<a href=\"javascript:signInfoView('" + dr["id"] + "')\">查看</a>&nbsp;<a href=\"javascript:del('" + dr["id"] + "')\">删除</a></li>";
                    str  += "<li id='li" + dr["id"] + "' data-option='x:" + dr["sign_x"] + ",y:" + dr["sign_y"] + ",id:" + dr["id"] + "'><input type='text' id='title" + dr["id"] + "'  value='" + dr["name"] + "' style='width:145px;' readonly />&nbsp;<a href=\"javascript:signInfoEdit('" + dr["id"] + "')\">[编辑]</a>&nbsp;<a href=\"javascript:signInfoView('" + dr["id"] + "')\">[查看]</a>&nbsp;<a href=\"javascript:del('" + dr["id"] + "')\">[删除]</a></li>";
                    jsIn += "   var menu = new BootstrapMenu('#" + dr["id"] + "', {actions: [{name: '编辑',onClick: function() {signInfoEdit('" + dr["id"] + "');}}, {name: '查看',onClick: function() {signInfoView('" + dr["id"] + "');}}, {name: '重新标记',onClick: function() {signInfoReEdit('" + dr["id"] + "');}}]}); ";//
                }
                else
                {
                    str  += "<li id='li" + dr["id"] + "' data-option='x:" + dr["sign_x"] + ",y:" + dr["sign_y"] + ",id:" + dr["id"] + "'><input type='text' id='title" + dr["id"] + "'  value='" + dr["name"] + "' style='width:145px;' readonly />&nbsp;<a href=\"javascript:signInfoView('" + dr["id"] + "')\">[查看]</a></br> <span style='background-color: wheat;'>标记人:" + dr["v_xm"] + "&nbsp;;标记时间:" + dr["sign_time"] + "</span></li>";
                    jsIn += "   var menu = new BootstrapMenu('#" + dr["id"] + "', {actions: [ {name: '查看',onClick: function() {signInfoView('" + dr["id"] + "');}}]}); ";//
                }
                //strPoint += "<img src=\'style/sign.png\' id=\'" + dr["id"] + "_img\' class=\'pointerImg\' onClick=\'showInfo(" + dr["id"] + ");\'>";
                //strPoint += "<img src=\'style/sign.png\' id='" + dr["id"] + "_img' class='pointerImg' onclick='showInfo(" + dr["id"] + "); ' style='display: block; left:" + dr["sign_x"] + "px; top:" + dr["sign_y"] + "px; '>";
                strPoint += dr["sign_x"] + "," + dr["sign_y"] + "," + dr["id"] + "," + dr["name"] + "," + dr["v_xm"] + ";";
            }
        }
        else
        {
        }
        //jsIn = "var menu = new BootstrapMenu('#4c447496-f1b5-4d53-8cc6-375d194e7d2a', {actions: [{name: '谷歌',onClick: function() {alert('谷歌');}}, {name: '百度',onClick: function() {alert('百度');}}]}); ";

        liInfo.Value  = str;
        liPoint.Value = strPoint;
        liCount.Value = dt.Rows.Count.ToString();
    }
Example #5
0
    public void saveData(int ii)
    {
        OAJournal model = this.GetModel(ii);

        if (this.action == "add")
        {
            this.pcSer.Add(model);
            saveRY(model.Id);
        }
        else if (this.action == "edit")
        {
            this.pcSer.Update(model);
            publicDbOpClass.ExecSqlString("DELETE from OA_Journal_Append where journal_id='" + model.Id + "'");
            saveRY(model.Id);
        }
        if (ii == 1)
        {
            string strSYR  = hfldTo.Value.ToString();     //审阅人
            string strXGRS = hfldCopyto.Value.ToString(); //相关人
            //发送微信消息
            WXAPI.sendWeChatMsg(UserCode.ToString(), strSYR, strXGRS, "log", model.Id.ToString(), model.title.ToString(), model.create_date.ToString());
            //string strUsers = "";
            //if (!string.IsNullOrEmpty(strSYR))
            //{
            //    strUsers += "'" + strSYR + "'";
            //}
            //if (!string.IsNullOrEmpty(strXGRS))
            //{
            //    string[] strXGR = strXGRS.Split(',');
            //    strUsers += "," + "'" + strXGRS + "'";
            //    //strUsers += "|"+ strXGRS.Replace(',','|');
            //}
            //string strSQL1 = "select * from PT_yhmc where v_yhdm ='" + base.UserCode + "'";
            //DataTable dt1 = publicDbOpClass.DataTableQuary(strSQL1);
            //string strSQL = "select * from PT_yhmc where v_yhdm in(" + strUsers + ")";
            //DataTable dt = publicDbOpClass.DataTableQuary(strSQL);
            ////string wxUsers = "";
            //if (dt.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        //    wxUsers += dr["WXID"] + "|";
            //        //}
            //        //string str0 = "";//"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx251384a873c4d422&redirect_uri=";
            //        string str1 = new BasicConfigService().GetValue("domain");
            //        string str2 = "/WeChat/log/show.html?id=" + model.Id + "&userType=tj&userID="+ dr["v_yhdm"];
            //        // string str3 = "";//"&action=add&response_type=code&scope=snsapi_base#wechat_redirect";

            //        // string str4 = System.Web.HttpUtility.UrlEncode(str1 + str2);//System.Web.HttpUtility.UrlDecode("");
            //        // string str4 = str1 + str2;
            //        //string strURL = str0 + str4 + str3;

            //        //WXAPI.sendText(1000008, "您有新的工作日志待查阅\n" + model.title.ToString() + model.start_time.ToString() + "\n", strURL, wxUsers.Substring(0, wxUsers.Length - 1));
            //        //WXAPI.sendText(1000008, "您有新的工作日志待查阅\n<h2><b>" + model.title.ToString() + "</b></h2>[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "]\n", strURL, dr["WXID"].ToString());
            //        //string description = "< div class=\"gray\">[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + model.create_date.ToString() + "</div> <div class=\"normal\">"+ model.content.ToString()+ "</div><div class=\"highlight\">请于2016年10月10日前联系行政同事领取</div>";
            //        string strURL = str1 + str2;
            //        string strTitle = "您有新的工作日志待查阅";
            //        string description = "<div class=\\\"highlight\\\">" + model.title.ToString() + "</div><div class=\\\"gray\\\">[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + model.create_date.ToString() + "</div>";
            //        string btntxt = "点击查看";
            //        WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //    }
            // }
        }
        base.RegisterScript("top.ui.tabSuccess({parentName:'_Journal'});");
    }
Example #6
0
    //保存评论
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //保存评论
        OAJournalComment model3 = this.GetModel();

        this.pcSer4.Add(model3);

        //保存评论@的人
        OAJournalAppend model2  = new OAJournalAppend();
        string          strXGRS = hfldCopyto.Value.ToString();//评论@相关人

        if (!string.IsNullOrEmpty(strXGRS))
        {
            string   strUsers = "";
            string[] strXGR   = strXGRS.Split(',');
            foreach (string str in strXGR)
            {
                strUsers += "'" + str + "'" + ",";
                DataTable dt = pcSer2.resulet(str, Id);
                if (dt.Rows.Count > 0)
                {
                }
                else
                {
                    model2.Id         = Guid.NewGuid().ToString(); //主键
                    model2.journal_id = Id;                        //日志ID
                    model2.user_id    = str;                       //审阅人ID
                    model2.user_type  = 1;                         // 3 提交人、0 审阅人、1相关人、2审阅及相关人;
                    this.pcSer2.Add(model2);
                }
            }
            //发送微信消息
            WXAPI.sendWeChatMsg(UserCode.ToString(), "", strXGRS, "logPL", this.Id, title.Text.ToString(), create_date.Text.ToString());
            //string strSQL = "select * from PT_yhmc where v_yhdm in(" + strUsers.Substring(0, strUsers.Length-1) + ")";
            //DataTable dt2 = publicDbOpClass.DataTableQuary(strSQL);
            ////string wxUsers = "";
            //if (dt2.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt2.Rows)
            //    {
            //        //    wxUsers += dr["WXID"] + "|";
            //        //}
            //        //string str0 = "";//"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx251384a873c4d422&redirect_uri=";
            //        string str1 = new BasicConfigService().GetValue("domain");
            //        string str2 = "/WeChat/log/show.html?id=" + this.KeyId.Value.ToString() + "&userType=tj&userID="+ dr["v_yhdm"];
            //        //string str3 = "";//"&action=add&response_type=code&scope=snsapi_base#wechat_redirect";
            //        string str4 = System.Web.HttpUtility.UrlEncode(str1 + str2);//System.Web.HttpUtility.UrlDecode("");
            //                                                                    // string strURL = str0 + str4 + str3;
            //                                                                    // //WXAPI.sendText(1000008, "有新的工作日志评论@您\n" + title.Text.ToString() + "\n", strURL, wxUsers.Substring(0, wxUsers.Length - 1));
            //                                                                    //WXAPI.sendText(1000008, "有新的工作日志评论@您\n<h2><b>" + title.Text.ToString() + "</b></h2>[填写人:"+ creater.Text.ToString() + "]\n", strURL, dr["WXID"].ToString());

            //        // string strTitle = "有新的工作日志评论@您";
            //        // string description = "<div class=\\\"highlight\\\">" + title.Text.ToString() + "</div><div class=\\\"gray\\\">[填写人:" + creater.Text.ToString() + "] " + this.create_date.Text.ToString() + "</div>";
            //        // string btntxt = "点击查看";
            //        // WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //        string strSQL1 = "select * from PT_yhmc where v_yhdm ='" + dr["v_yhdm"] + "'";
            //        DataTable dt1 = publicDbOpClass.DataTableQuary(strSQL1);
            //        string strURL = str1 + str2;
            //        string strTitle = "有新的工作日志评论@您";
            //        string description = "<div class=\\\"highlight\\\">" + title.Text.ToString() + "</div><div class=\\\"gray\\\">[评论人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + DateTime.Now.ToShortDateString()+ "</div>";
            //        string btntxt = "点击查看";
            //        WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //    }
            //}
        }
        base.RegisterScriptRefresh();
    }
Example #7
0
    public string strWhere()
    {
        string strWhere = " ";// and ...

        System.DateTime?startTime = DateTimeHelper.GetDateTime(this.txtStartTime.Text);
        System.DateTime?endTime   = DateTimeHelper.GetDateTime(this.txtEndTime.Text);
        if (startTime.HasValue)
        {
            strWhere += " and start_time >='" + startTime.Value + "'";
        }
        if (endTime.HasValue)
        {
            strWhere += " and start_time <'" + endTime.Value.AddDays(1.0) + "'";
        }
        System.DateTime?stime = DateTimeHelper.GetDateTime(this.stime.Text);
        System.DateTime?etime = DateTimeHelper.GetDateTime(this.etime.Text);
        if (stime.HasValue)
        {
            strWhere += " and create_time >='" + stime.Value + "'";
        }
        if (etime.HasValue)
        {
            strWhere += " and create_time <'" + etime.Value.AddDays(1.0) + "'";
        }

        if (!string.IsNullOrEmpty(txtTitle.Text))
        {
            strWhere += " and title like '%" + txtTitle.Text.ToString().Trim() + "%'";
        }
        if (type_id.SelectedValue != "")
        {
            strWhere += " and type_id ='" + type_id.SelectedValue + "'";
        }
        if (status.SelectedValue != "")
        {
            strWhere += " and status ='" + Convert.ToInt32(status.SelectedValue) + "'";
        }
        //if (base.UserCode != "00000000")
        //{
        //    strWhere += " and creater_id ='" + UserCode + "'";
        //}
        //任务状态   0草稿、1未开始、2执行中、3已完成、4已关闭、5已删除
        strWhere += " and status !='5' and status !='0' and status !='3' and status !='4'";
        //string strRYS = hfldTo.Value.ToString();//执行人
        //if (!string.IsNullOrEmpty(strRYS))
        //{
        //    string[] strXGR = strRYS.Split(',');
        //    string strs = "";
        //    foreach (string str in strXGR)
        //    {
        //        strs += "'" + str + "',";
        //    }
        //关联 任务执行人
        strWhere += " and OA_Task.Id in (SELECT task_id FROM OA_Task_Append where (user_type=0 or user_type=2 ) and user_id ='" + UserCode.ToString() + "') ";
        //}
        return(strWhere);
    }
Example #8
0
        //public string Keyword { get { return txtSearch.Text; } set { txtSearch.Text = value; } }
        #endregion

        public void BindData(BindType bindType)
        {
            var queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                FilterKey = UserCode.ToString(),
                BindType  = bindType,
                //Keyword = Keyword
            };
            var userProfiles = _controlPanel.GetUserProfiles(queryArgument);

            if (userProfiles != null)
            {
                if (bindType == BindType.Form)
                {
                    var objUserProfile = userProfiles.FirstOrDefault();
                    if (objUserProfile != null)
                    {
                        UserCode    = objUserProfile.UCode;
                        UserLoginId = objUserProfile.LoginId.Trim();
                        Password    = objUserProfile.Password.Trim();
                        UserName    = objUserProfile.Name.Trim();
                        //LastName=objUserProfile.
                        Address = objUserProfile.Address.Trim();
                        City    = objUserProfile.City.Trim();
                        Country = objUserProfile.Country.Trim();
                        var filter = new KeyValuePairItems
                        {
                            new KeyValuePairItem(Constants.filter1, Constants.CountryType),
                            new KeyValuePairItem(Constants.filter2, Country),
                            new KeyValuePairItem(Constants.DdldefaultText, Constants.DdlDefaultTextState),
                            new KeyValuePairItem(Constants.masterType, Constants.DdlCatHeaderData)
                        };
                        _genericClass.LoadDropDown(ddlState, filter, null, UserContext.DataBaseInfo);
                        State            = objUserProfile.State.Trim();
                        ZipCode          = objUserProfile.Zip.Trim();
                        Email            = objUserProfile.Email.Trim();
                        Mobile           = objUserProfile.Mobile.Trim();
                        ResidentialPhone = objUserProfile.ResPhone.Trim();
                        OfficePhone      = objUserProfile.OffPhone.Trim();
                        Dob        = objUserProfile.Dob.GetValueOrDefault();
                        EmployeeId = objUserProfile.EmpId.Trim();
                        Gender     = objUserProfile.Gender.Trim();
                        filter     = new KeyValuePairItems
                        {
                            new KeyValuePairItem(Constants.key, objUserProfile.UCode.ToString()),
                            new KeyValuePairItem(Constants.filter1, objUserProfile.Designation.Level.ToString(CultureInfo.InvariantCulture)),
                            new KeyValuePairItem(Constants.DdldefaultText, Constants.DdlDefaultTextRManager),
                            new KeyValuePairItem(Constants.masterType, Constants.DdlRManager)
                        };
                        _genericClass.LoadDropDown(ddlReporting, filter, null, UserContext.DataBaseInfo);
                        ReportingTo = objUserProfile.ReportingTo.ToString().Trim();
                        Warehouse   = objUserProfile.Wh.Trim();
                        Department  = objUserProfile.Dept.Trim();
                        Designation = objUserProfile.Designation.Id.Trim();
                        Avator      = objUserProfile.Avatar.Trim();
                        ActiveTill  = objUserProfile.ActiveTill.GetValueOrDefault();
                        Branch      = objUserProfile.Branch.Trim().Trim();
                        Bu          = objUserProfile.Bu.Trim();
                        Status      = objUserProfile.Off.Trim();
                    }
                    lnkSave.Visible = hidAction.Value != Constants.ViewAction;
                    uplForm.Update();
                }
                else
                {
                    var userProfile = userProfiles.ToList();
                    if (UserContext.UserProfile.Designation.Id.Trim() != "SA")
                    {
                        if (userProfiles.Any())
                        {
                            userProfile = userProfiles.Where(x => x.Designation.Id.Trim() != "SA").ToList();
                        }
                    }
                    GridViewTable.DataSource = userProfile;
                    GridViewTable.DataBind();
                    uplView.Update();
                }
            }
        }